ci(release): drop setup-node from build/submit jobs; render nfpm config #5
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: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g. 0.1.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| # 1) Create the GitHub Release (draft) up front so each per-platform build job | |
| # uploads straight to it via the Releases API (pattern from pairux.com). | |
| create-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.v.outputs.tag }} | |
| version: ${{ steps.v.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - id: v | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then V="${{ github.event.inputs.version }}"; else V="${GITHUB_REF_NAME#v}"; fi | |
| echo "version=$V" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$V" >> "$GITHUB_OUTPUT" | |
| - name: Create draft release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TAG="${{ steps.v.outputs.tag }}" | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release edit "$TAG" --draft | |
| else | |
| gh release create "$TAG" --draft --title "TronBrowser $TAG" --generate-notes | |
| fi | |
| # 2) Build each platform's artifacts on its own runner and upload them. | |
| build: | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, platform: linux } | |
| - { os: macos-latest, platform: macos } | |
| - { os: windows-latest, platform: windows } | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Runners ship Node preinstalled; these steps only run scripts + packaging, | |
| # so we skip setup-node (its packageManager:pnpm detection causes cache noise). | |
| - name: Sync version | |
| run: node scripts/set-version.mjs "${{ needs.create-release.outputs.version }}" | |
| - name: Package (linux/macos) | |
| if: matrix.platform != 'windows' | |
| run: bash apps/desktop/scripts/build-release.sh "v${{ needs.create-release.outputs.version }}" ${{ matrix.platform }} | |
| - name: Package (linux deb + rpm) | |
| if: matrix.platform == 'linux' | |
| run: | | |
| curl -sSfL "https://github.com/goreleaser/nfpm/releases/download/v2.41.0/nfpm_2.41.0_amd64.deb" -o /tmp/nfpm.deb | |
| sudo dpkg -i /tmp/nfpm.deb | |
| bash packaging/build-deb-rpm.sh "v${{ needs.create-release.outputs.version }}" | |
| - name: Package (windows) | |
| if: matrix.platform == 'windows' | |
| shell: pwsh | |
| run: | | |
| $stage = "dist/stage/tronbrowser" | |
| New-Item -ItemType Directory -Force -Path "$stage/extensions" | Out-Null | |
| Copy-Item apps/desktop/launcher/tronbrowser "$stage/tronbrowser" | |
| Copy-Item apps/desktop/launcher/tronbrowser.cmd "$stage/tronbrowser.cmd" | |
| Copy-Item -Recurse apps/desktop/extensions/ai-sidebar "$stage/extensions/ai-sidebar" | |
| Copy-Item LICENSE "$stage/LICENSE" | |
| "v${{ needs.create-release.outputs.version }}" | Out-File -Encoding ascii "$stage/VERSION" | |
| New-Item -ItemType Directory -Force -Path dist | Out-Null | |
| Compress-Archive -Path "dist/stage/tronbrowser" -DestinationPath "dist/tronbrowser-win-x64.zip" -Force | |
| - name: Upload to release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| shopt -s nullglob | |
| assets=(dist/tronbrowser-*.tar.gz dist/tronbrowser-*.zip dist/*.deb dist/*.rpm) | |
| gh release upload "${{ needs.create-release.outputs.tag }}" "${assets[@]}" --clobber | |
| # 3) Publish (un-draft) once every platform has uploaded. | |
| publish: | |
| needs: [create-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Un-draft the release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false --repo "${{ github.repository }}" |