Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

fix: resolve YAML syntax error in release workflow #8

fix: resolve YAML syntax error in release workflow

fix: resolve YAML syntax error in release workflow #8

Workflow file for this run

name: Build and Release CLI
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
prerelease:
description: "Create as prerelease (default: true)"
required: false
default: true
type: boolean
release_type:
description: "Release type"
required: false
default: "prerelease"
type: choice
options:
- prerelease
- release
permissions:
contents: write
packages: write
actions: read
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
encryptx-backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Windows binary
run: |
cd encryptx-backend
cargo build --release --target x86_64-pc-windows-msvc
- name: Create Windows package
run: |
mkdir encryptx-windows
copy encryptx-backend\target\x86_64-pc-windows-msvc\release\encryptx-backend.exe encryptx-windows\encryptx.exe
copy README.md encryptx-windows\
copy LICENSE encryptx-windows\
echo "EncryptX CLI v${{ github.ref_name }}" > encryptx-windows\VERSION.txt
echo "Build: ${{ github.sha }}" >> encryptx-windows\VERSION.txt
echo "Date: ${{ github.event.head_commit.timestamp }}" >> encryptx-windows\VERSION.txt
- name: Create MSI installer with WiX Toolset
run: |
# Install WiX Toolset v3 (available on GitHub runners)
choco install wixtoolset -y --force
# Create WiX source file
$wxsContent = @'
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="EncryptX CLI" Language="1033" Version="1.6.0" Manufacturer="AmitxD" UpgradeCode="{12345678-1234-1234-1234-123456789012}">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="EncryptX CLI" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!-- Add to system PATH -->
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="EncryptX" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="MainExecutable" Guid="{12345678-1234-1234-1234-123456789014}" Win64="yes">
<File Id="EncryptXExe" Source="encryptx-windows\encryptx.exe" KeyPath="yes" />
<!-- Add to system PATH -->
<Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" />
</Component>
<Component Id="Documentation" Guid="{12345678-1234-1234-1234-123456789015}" Win64="yes">
<File Id="ReadmeFile" Source="encryptx-windows\README.md" />
<File Id="LicenseFile" Source="encryptx-windows\LICENSE" />
<File Id="VersionFile" Source="encryptx-windows\VERSION.txt" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
'@
$wxsContent | Out-File -FilePath "encryptx.wxs" -Encoding UTF8
# Find WiX installation path dynamically
$wixPath = Get-ChildItem "C:\Program Files (x86)" -Directory -Name "WiX Toolset*" | Sort-Object -Descending | Select-Object -First 1
$candlePath = "C:\Program Files (x86)\$wixPath\bin\candle.exe"
$lightPath = "C:\Program Files (x86)\$wixPath\bin\light.exe"
Write-Host "Using WiX Toolset at: $wixPath"
Write-Host "Candle path: $candlePath"
Write-Host "Light path: $lightPath"
# Verify WiX tools exist
if (-not (Test-Path $candlePath)) {
throw "Candle.exe not found at $candlePath"
}
if (-not (Test-Path $lightPath)) {
throw "Light.exe not found at $lightPath"
}
# Build MSI using dynamic paths
Write-Host "Building WiX object file..."
& $candlePath encryptx.wxs
if ($LASTEXITCODE -ne 0) {
throw "Candle.exe failed with exit code $LASTEXITCODE"
}
Write-Host "Building MSI installer..."
& $lightPath -ext WixUIExtension encryptx.wixobj -o encryptx-windows\encryptx-installer.msi
if ($LASTEXITCODE -ne 0) {
throw "Light.exe failed with exit code $LASTEXITCODE"
}
Write-Host "MSI installer created successfully!"
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: encryptx-windows
path: encryptx-windows/
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
encryptx-backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Linux binary
run: |
cd encryptx-backend
cargo build --release --target x86_64-unknown-linux-gnu
- name: Create Linux package
run: |
mkdir encryptx-linux
cp encryptx-backend/target/x86_64-unknown-linux-gnu/release/encryptx-backend encryptx-linux/encryptx
cp README.md encryptx-linux/
cp LICENSE encryptx-linux/
echo "EncryptX CLI v${{ github.ref_name }}" > encryptx-linux/VERSION.txt
echo "Build: ${{ github.sha }}" >> encryptx-linux/VERSION.txt
echo "Date: ${{ github.event.head_commit.timestamp }}" >> encryptx-linux/VERSION.txt
# Create install script
cat > encryptx-linux/install.sh << 'EOF'
#!/bin/bash
set -e
echo "Installing EncryptX CLI..."
# Check if running as root
if [[ $EUID -eq 0 ]]; then
INSTALL_DIR="/usr/local/bin"
else
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
# Copy binary
cp encryptx "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/encryptx"
echo "EncryptX CLI installed to $INSTALL_DIR/encryptx"
echo "Make sure $INSTALL_DIR is in your PATH"
# Add to PATH if not already there
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "Add this to your shell profile (.bashrc, .zshrc, etc.):"
echo "export PATH=\"$INSTALL_DIR:\$PATH\""
fi
echo "Installation complete!"
EOF
chmod +x encryptx-linux/install.sh
# Create tarball
tar -czf encryptx-linux-x64.tar.gz -C encryptx-linux .
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: encryptx-linux
path: |
encryptx-linux-x64.tar.gz
encryptx-linux/
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
encryptx-backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build macOS binary
run: |
cd encryptx-backend
cargo build --release --target aarch64-apple-darwin
- name: Create macOS package
run: |
mkdir encryptx-macos
cp encryptx-backend/target/aarch64-apple-darwin/release/encryptx-backend encryptx-macos/encryptx
cp README.md encryptx-macos/
cp LICENSE encryptx-macos/
echo "EncryptX CLI v${{ github.ref_name }}" > encryptx-macos/VERSION.txt
echo "Build: ${{ github.sha }}" >> encryptx-macos/VERSION.txt
echo "Date: ${{ github.event.head_commit.timestamp }}" >> encryptx-macos/VERSION.txt
# Create install script
cat > encryptx-macos/install.sh << 'EOF'
#!/bin/bash
set -e
echo "Installing EncryptX CLI for macOS..."
# Check if running as root
if [[ $EUID -eq 0 ]]; then
INSTALL_DIR="/usr/local/bin"
else
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
# Copy binary
cp encryptx "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/encryptx"
# Remove quarantine attribute (for downloaded binaries)
xattr -d com.apple.quarantine "$INSTALL_DIR/encryptx" 2>/dev/null || true
echo "EncryptX CLI installed to $INSTALL_DIR/encryptx"
echo "Make sure $INSTALL_DIR is in your PATH"
# Add to PATH if not already there
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "Add this to your shell profile (.bashrc, .zshrc, etc.):"
echo "export PATH=\"$INSTALL_DIR:\$PATH\""
fi
echo "Installation complete!"
EOF
chmod +x encryptx-macos/install.sh
# Create tarball
tar -czf encryptx-macos-arm64.tar.gz -C encryptx-macos .
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: encryptx-macos
path: |
encryptx-macos-arm64.tar.gz
encryptx-macos/
create-release:
needs: [build-windows, build-linux, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Prepare release assets
run: |
# Debug: List all downloaded artifacts
echo "=== Downloaded artifacts structure ==="
find . -name "*.tar.gz" -o -name "*.msi" | head -20
echo "=== Directory structure ==="
ls -la
echo "=== encryptx-linux contents ==="
ls -la encryptx-linux/ || echo "encryptx-linux directory not found"
echo "=== encryptx-macos contents ==="
ls -la encryptx-macos/ || echo "encryptx-macos directory not found"
echo "=== encryptx-windows contents ==="
ls -la encryptx-windows/ || echo "encryptx-windows directory not found"
# Create release directory
mkdir release-assets
# Copy Windows MSI installer
cp encryptx-windows/encryptx-installer.msi release-assets/encryptx-windows-x64-installer.msi
# Copy tarballs (they should be inside the artifact directories)
cp encryptx-linux/encryptx-linux-x64.tar.gz release-assets/
cp encryptx-macos/encryptx-macos-arm64.tar.gz release-assets/
# Create checksums
cd release-assets
sha256sum * > checksums.txt
# List files
ls -la
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
artifacts: "release-assets/*"
token: ${{ secrets.GITHUB_TOKEN }}
name: "EncryptX CLI v${{ github.ref_name }}"
tag: ${{ github.ref_name }}
prerelease: ${{ github.event_name == 'push' || github.event.inputs.release_type == 'prerelease' || github.event.inputs.prerelease == true || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'rc') || contains(github.ref_name, 'dev') }}
body: |
# EncryptX CLI ${{ github.ref_name }}
🔐 **Secure file encryption tool with AES-256-GCM encryption**
${{ github.event_name == 'push' && '⚠️ **Pre-release**: This is an automated pre-release from tag push. Use with caution in production.' || '' }}
${{ github.event.inputs.release_type == 'prerelease' && '⚠️ **Pre-release**: This is a pre-release version. Use with caution in production.' || '' }}
## 📦 Downloads
| Platform | Architecture | Download | Size |
|----------|-------------|----------|------|
| Windows | x64 | [MSI Installer](./encryptx-windows-x64-installer.msi) | ~5MB |
| Linux | x64 | [Tarball](./encryptx-linux-x64.tar.gz) | ~3MB |
| macOS | ARM64 (Apple Silicon) | [Tarball](./encryptx-macos-arm64.tar.gz) | ~3MB |
## 🚀 Quick Start
### Windows
```cmd
# Download and run the MSI installer
# EncryptX will be automatically added to your PATH
encryptx encrypt --file secret.txt --password mypassword
```
### Linux
```bash
# Download and extract
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/encryptx-linux-x64.tar.gz
tar -xzf encryptx-linux-x64.tar.gz
cd encryptx-linux
./install.sh
# Use the CLI
encryptx encrypt --file secret.txt --password mypassword
```
### macOS
```bash
# Download and extract
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/encryptx-macos-arm64.tar.gz
tar -xzf encryptx-macos-arm64.tar.gz
cd encryptx-macos
./install.sh
# Use the CLI
encryptx encrypt --file secret.txt --password mypassword
```
## 🔧 CLI Usage
```bash
# Encrypt with password
encryptx encrypt --file document.pdf --password mysecret
# Encrypt with auto-generated key
encryptx encrypt --file data.zip
# Decrypt with password
encryptx decrypt --file document.xd --password mysecret
# Generate secure key
encryptx generate-key
```
## ✨ Features
- 🔐 **AES-256-GCM** authenticated encryption
- 🧠 **Argon2id** password-based key derivation
- 📦 **Automatic compression** with zstd
- 🛡️ **Memory-safe** Rust implementation
- 🔑 **Dual modes**: password or key-based encryption
- 📁 **Any file type** supported
## 🔒 Security
- **No telemetry** - completely offline operation
- **No key storage** - keys never saved to disk
- **Memory safety** - automatic key zeroization
- **Authenticated encryption** - prevents tampering
## 📋 System Requirements
- **Windows**: Windows 10/11 64-bit
- **Linux**: x86_64 with glibc 2.17+
- **macOS**: Apple Silicon (M1/M2) with macOS 11+
## 🔍 Verification
Verify download integrity with checksums:
```bash
sha256sum -c checksums.txt
```
---
### 📊 Build Information
- **Branch**: ${{ github.ref_name }}
- **Commit**: ${{ github.sha }}
- **Build Date**: ${{ github.event.head_commit.timestamp }}
- **Workflow**: [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
### 🐛 Issues & Support
- [Report bugs](https://github.com/${{ github.repository }}/issues)
- [Documentation](https://github.com/${{ github.repository }}#readme)
- [Security Policy](https://github.com/${{ github.repository }}/blob/main/SECURITY.md)
cleanup:
needs: create-release
runs-on: ubuntu-latest
if: always()
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
encryptx-windows
encryptx-linux
encryptx-macos