Merge pull request #74 from beNative/codex/fix-release-builds-and-aut… #12
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 ia32 | |
| build_command: npx electron-builder --publish never --win --ia32 | |
| artifact_name: windows-ia32-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: 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 (ia32) --- | |
| if [[ -d artifacts/windows-ia32-artifacts ]]; then | |
| for file in artifacts/windows-ia32-artifacts/*.exe; do | |
| base="$(basename "$file")" | |
| target="$base" | |
| if [[ "$base" != *-ia32.exe ]]; then | |
| target="${base%.exe}-ia32.exe" | |
| fi | |
| cp "$file" "release_upload/$target" | |
| done | |
| for file in artifacts/windows-ia32-artifacts/*.exe.blockmap; do | |
| base="$(basename "$file")" | |
| target="$base" | |
| if [[ "$base" != *-ia32.exe.blockmap ]]; then | |
| target="${base/.exe/-ia32.exe}" | |
| fi | |
| cp "$file" "release_upload/$target" | |
| done | |
| if [[ -f artifacts/windows-ia32-artifacts/latest.yml ]]; then | |
| cp artifacts/windows-ia32-artifacts/latest.yml release_upload/latest-ia32.yml | |
| 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 }} | |