Merge pull request #106 from beNative/codex/prepare-github-software-r… #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release on Tag | |
| on: | |
| push: | |
| tags: [ "v*.*.*" ] # e.g. v1.2.3 | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # needed to create releases & upload assets | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.display_name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| display_name: macOS x64 | |
| build_command: npx electron-builder --publish never --mac | |
| artifact_name: macOS-artifacts | |
| - os: windows-latest | |
| display_name: Windows x64 | |
| build_command: npx electron-builder --publish never --win --x64 | |
| artifact_name: windows-x64-artifacts | |
| - os: windows-latest | |
| display_name: Windows win32 | |
| build_command: npx electron-builder --publish never --win --ia32 | |
| artifact_name: windows-win32-artifacts | |
| - os: ubuntu-latest | |
| display_name: Linux x64 | |
| build_command: npx electron-builder --publish never --linux --x64 | |
| artifact_name: linux-x64-artifacts | |
| - os: ubuntu-latest | |
| display_name: Linux armv7l | |
| build_command: npx electron-builder --publish never --linux --armv7l | |
| artifact_name: linux-armv7l-artifacts | |
| - os: ubuntu-latest | |
| display_name: Linux arm64 | |
| build_command: npx electron-builder --publish never --linux --arm64 | |
| artifact_name: linux-arm64-artifacts | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } # helps release notes/changelogs | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - run: ${{ matrix.build_command }} | |
| - name: Normalize Windows win32 artifact naming | |
| if: matrix.display_name == 'Windows win32' | |
| shell: bash | |
| run: node electron/scripts/normalize-win32-artifacts.mjs | |
| - name: Verify update manifests were produced | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| manifests=(release/latest*.yml) | |
| if [ ${#manifests[@]} -eq 0 ]; then | |
| echo "::error::No latest*.yml manifests found in release/ directory for ${{ matrix.display_name }}." | |
| ls -al release || true | |
| exit 1 | |
| fi | |
| printf 'Detected update manifests for %s:\n' "${{ matrix.display_name }}" | |
| for manifest in "${manifests[@]}"; do | |
| printf ' - %s\n' "$manifest" | |
| done | |
| - name: Upload build artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| if-no-files-found: error | |
| path: | | |
| release/*.exe | |
| release/*.exe.blockmap | |
| release/*.dmg | |
| release/*.dmg.blockmap | |
| release/*.AppImage | |
| release/*.deb | |
| release/latest*.yml | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - name: Generate release notes | |
| id: notes | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const tag = context.ref.replace('refs/tags/',''); | |
| const r = await github.rest.repos.generateReleaseNotes({ owner, repo, tag_name: tag }); | |
| core.setOutput('body', r.data.body); | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*-artifacts" | |
| path: artifacts | |
| merge-multiple: false | |
| - name: Prepare release assets | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| mkdir -p release_upload | |
| # --- Windows (x64) --- | |
| if [[ -d artifacts/windows-x64-artifacts ]]; then | |
| for file in artifacts/windows-x64-artifacts/*.exe; do | |
| cp "$file" release_upload/ | |
| done | |
| for file in artifacts/windows-x64-artifacts/*.exe.blockmap; do | |
| cp "$file" release_upload/ | |
| done | |
| if [[ -f artifacts/windows-x64-artifacts/latest.yml ]]; then | |
| cp artifacts/windows-x64-artifacts/latest.yml release_upload/latest.yml | |
| fi | |
| fi | |
| # --- Windows (win32) --- | |
| if [[ -d artifacts/windows-win32-artifacts ]]; then | |
| for file in artifacts/windows-win32-artifacts/*.exe; do | |
| cp "$file" release_upload/ | |
| done | |
| for file in artifacts/windows-win32-artifacts/*.exe.blockmap; do | |
| cp "$file" release_upload/ | |
| done | |
| if [[ -f artifacts/windows-win32-artifacts/latest-win32.yml ]]; then | |
| cp artifacts/windows-win32-artifacts/latest-win32.yml release_upload/latest-win32.yml | |
| elif [[ -f artifacts/windows-win32-artifacts/latest.yml ]]; then | |
| echo "::warning::latest-win32.yml was not generated; falling back to latest.yml naming." | |
| cp artifacts/windows-win32-artifacts/latest.yml release_upload/latest-win32.yml | |
| else | |
| echo "::error::Missing win32 update manifest in artifacts/windows-win32-artifacts." | |
| exit 1 | |
| fi | |
| fi | |
| # --- macOS --- | |
| if [[ -d artifacts/macos-artifacts ]]; then | |
| for pattern in "*.dmg" "*.dmg.blockmap" "latest-mac*.yml"; do | |
| for file in artifacts/macos-artifacts/$pattern; do | |
| cp "$file" release_upload/ | |
| done | |
| done | |
| fi | |
| # --- Linux variants --- | |
| for dir in linux-x64-artifacts linux-arm64-artifacts linux-armv7l-artifacts; do | |
| if [[ -d artifacts/$dir ]]; then | |
| for pattern in "*.AppImage" "*.deb" "latest-linux*.yml"; do | |
| for file in artifacts/$dir/$pattern; do | |
| cp "$file" release_upload/ | |
| done | |
| done | |
| fi | |
| done | |
| shopt -u nullglob | |
| - name: List files to upload (debug) | |
| run: ls -alR release_upload | |
| - name: Create/Update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| body: ${{ steps.notes.outputs.body }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| release_upload/** | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |