Merge pull request #513 from manojmallick/develop #168
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 Binaries | |
| # Triggered by version tags, runs in parallel with npm-publish.yml. | |
| # Builds a standalone sigmap binary for each platform using Node.js SEA, | |
| # then attaches all artifacts + checksums to the GitHub Release. | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]*' | |
| permissions: | |
| contents: write # upload release assets | |
| jobs: | |
| # ── Build matrix: one job per platform ────────────────────────────────────── | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest # arm64 (GitHub default as of 2024) | |
| artifact: sigmap-darwin-arm64 | |
| - os: ubuntu-latest # x64 | |
| artifact: sigmap-linux-x64 | |
| - os: windows-latest # x64 | |
| artifact: sigmap-win32-x64.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Build binary | |
| run: node scripts/build-binary.mjs | |
| - name: Smoke-test binary | |
| run: node scripts/verify-binary.mjs | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/${{ matrix.artifact }} | |
| if-no-files-found: warn | |
| retention-days: 1 | |
| # ── Attach all binaries + checksums to the GitHub Release ────────────────── | |
| release-attach: | |
| name: Attach to GitHub Release | |
| needs: build | |
| if: always() && !cancelled() && needs.build.result != 'cancelled' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/release | |
| merge-multiple: true | |
| - name: List downloaded artifacts | |
| run: | | |
| ls -lh dist/release/ | |
| - name: Generate checksums | |
| working-directory: dist/release | |
| run: | | |
| # Only checksum files that were successfully built | |
| sha256sum $(ls sigmap-darwin-arm64 sigmap-linux-x64 sigmap-win32-x64.exe 2>/dev/null) \ | |
| > sigmap-checksums.txt | |
| cat sigmap-checksums.txt | |
| - name: Ensure GitHub Release exists | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| if gh release view "$TAG" --json tagName -q .tagName > /dev/null 2>&1; then | |
| echo "✓ Release $TAG found" | |
| else | |
| echo "Release $TAG not found. Creating it..." | |
| gh release create "$TAG" \ | |
| --title "$TAG" \ | |
| --notes "Automated release for $TAG" | |
| echo "✓ Release $TAG created" | |
| fi | |
| - name: Upload binaries and checksums to GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| # Upload whatever binary artifacts were successfully built | |
| mapfile -t FILES < <(find dist/release -name 'sigmap-*' -type f | sort) | |
| if [ "${#FILES[@]}" -eq 0 ]; then | |
| echo "ERROR: no release files found in dist/release" | |
| exit 1 | |
| fi | |
| gh release upload "$TAG" "${FILES[@]}" --clobber | |
| echo "✓ Assets uploaded to $TAG" |