1
0
forked from adalal/openxer
Files
openxer/.github/workflows/release.yml
2026-11-25 18:38:03 -06:00

180 lines
6.8 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
name: Build Windows installer and portable zip
runs-on: windows-latest
env:
SIGNPATH_ENABLED: ${{ secrets.SIGNPATH_API_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
- name: Ensure Inno Setup 6 is installed
shell: pwsh
run: |
$iscc = Get-Command ISCC -ErrorAction SilentlyContinue
if (-not $iscc -and -not (Test-Path 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe')) {
choco install innosetup -y --no-progress
}
- name: Read workspace version
shell: pwsh
run: |
$ver = (Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"([^"]+)"').Matches[0].Groups[1].Value
echo "VERSION=$ver" >> $env:GITHUB_ENV
- name: Build packaged Windows executables
shell: pwsh
run: |
python desktop/build_release.py --output dist/OpenXER.exe
- name: Upload unsigned executables for SignPath
if: env.SIGNPATH_ENABLED == 'true'
id: upload-unsigned-exes
uses: actions/upload-artifact@v4
with:
name: unsigned-windows-exes
path: |
dist/OpenXER.exe
dist/openxer-cli.exe
- name: Sign Windows executables with SignPath
if: env.SIGNPATH_ENABLED == 'true'
uses: signpath/github-action-submit-signing-request@v3
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ secrets.SIGNPATH_ORG_ID }}
project-slug: 'openxer'
signing-policy-slug: 'release-signing'
github-artifact-id: ${{ steps.upload-unsigned-exes.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: 'dist'
- name: Build portable zip and Inno Setup installer
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path release-assets | Out-Null
python desktop/build_release.py --package-only --output dist/OpenXER.exe --installer --installer-output release-assets
Compress-Archive -Path dist/* -DestinationPath "release-assets/OpenXER-$env:VERSION-windows-x64.zip" -Force
Get-ChildItem release-assets
- name: Upload unsigned installer for SignPath
if: env.SIGNPATH_ENABLED == 'true'
id: upload-unsigned-installer
uses: actions/upload-artifact@v4
with:
name: unsigned-windows-installer
path: release-assets/OpenXER-*-setup.exe
- name: Sign Windows installer with SignPath
if: env.SIGNPATH_ENABLED == 'true'
uses: signpath/github-action-submit-signing-request@v3
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ secrets.SIGNPATH_ORG_ID }}
project-slug: 'openxer'
signing-policy-slug: 'release-signing'
github-artifact-id: ${{ steps.upload-unsigned-installer.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: 'release-assets'
- uses: actions/upload-artifact@v4
with:
name: release-windows
path: release-assets/*
build-linux:
name: Build Linux AppImage and portable tarball
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: System packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev desktop-file-utils file
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build release binaries
run: cargo build --release -p openxer-desktop -p openxer-automation
- name: Package portable tarball and AppImage
run: |
set -euo pipefail
VER=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)
mkdir -p release-assets "stage/OpenXER-${VER}-linux-x86_64"
STAGE="stage/OpenXER-${VER}-linux-x86_64"
cp target/release/OpenXER "$STAGE/openxer"
cp target/release/openxer-cli "$STAGE/openxer-cli"
chmod +x "$STAGE/openxer" "$STAGE/openxer-cli"
cp automation/README.md "$STAGE/CLI-MCP.md"
cp LICENSE-MIT LICENSE-APACHE THIRD_PARTY.md "$STAGE/"
cat > "$STAGE/openxer.mcp.json" <<'EOF'
{
"mcpServers": {
"openxer": {
"command": "<full path to openxer-cli>",
"args": ["mcp"]
}
}
}
EOF
tar -C stage -czf "release-assets/OpenXER-${VER}-linux-x86_64.tar.gz" "OpenXER-${VER}-linux-x86_64"
# Build AppImage from the same executables and icon.
APPDIR="stage/OpenXER.AppDir"
mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/doc/openxer"
cp "$STAGE/openxer" "$APPDIR/usr/bin/openxer"
cp "$STAGE/openxer-cli" "$APPDIR/usr/bin/openxer-cli"
cp "$STAGE/CLI-MCP.md" "$STAGE/LICENSE-MIT" "$STAGE/LICENSE-APACHE" "$STAGE/THIRD_PARTY.md" "$APPDIR/usr/share/doc/openxer/"
cp assets/icons/openxer_256.png "$APPDIR/openxer.png"
cat > "$APPDIR/openxer.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=OpenXER
Comment=Native desktop CPM scheduler for XER files
Exec=openxer %f
Icon=openxer
Categories=Office;ProjectManagement;
Terminal=false
EOF
cat > "$APPDIR/AppRun" <<'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "$0")")"
exec "$HERE/usr/bin/openxer" "$@"
EOF
chmod +x "$APPDIR/AppRun"
curl -fsSL -o stage/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x stage/appimagetool
ARCH=x86_64 stage/appimagetool --appimage-extract-and-run "$APPDIR" "release-assets/OpenXER-${VER}-x86_64.AppImage"
ls -lh release-assets
- uses: actions/upload-artifact@v4
with:
name: release-linux
path: release-assets/*
publish:
name: Publish GitHub Release
needs: [build-windows, build-linux]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate SHA256SUMS.txt
working-directory: artifacts
run: |
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*