Release #52
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: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g., 1.0.0)" | |
| required: true | |
| default: "1.0.0" | |
| draft: | |
| description: "Create as draft release?" | |
| required: false | |
| default: false | |
| type: boolean | |
| prerelease: | |
| description: "Mark as pre-release?" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| BINARY_NAME: b4 | |
| jobs: | |
| build-ui: | |
| name: Build UI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.18.2 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| cache-dependency-path: | | |
| ./src/http/ui/pnpm-lock.yaml | |
| - name: Build web UI | |
| working-directory: src/http/ui | |
| run: | | |
| pnpm install --frozen-lockfile | |
| VITE_APP_VERSION=${{ env.VERSION }} pnpm build | |
| - name: Upload UI artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ui-build | |
| path: src/http/ui/dist | |
| retention-days: 1 | |
| build-linux: | |
| name: Build Linux ${{ matrix.arch }} | |
| needs: build-ui | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| [ | |
| 386, | |
| amd64, | |
| arm64, | |
| armv5, | |
| armv6, | |
| armv7, | |
| loong64, | |
| mips, | |
| mipsle, | |
| mips64, | |
| mips64le, | |
| ppc64, | |
| ppc64le, | |
| riscv64, | |
| s390x, | |
| ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: src/go.mod | |
| - name: Download UI artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ui-build | |
| path: src/http/ui/dist | |
| - name: Build using Makefile | |
| run: | | |
| make linux-${{ matrix.arch }} VERSION=${{ env.VERSION }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-linux-${{ matrix.arch }} | |
| path: out/assets/* | |
| retention-days: 1 | |
| release: | |
| name: Create Release | |
| needs: [build-linux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: ${{ env.BINARY_NAME }}-* | |
| path: release-assets | |
| merge-multiple: true | |
| - name: Generate release files | |
| working-directory: release-assets | |
| run: | | |
| # Combine all individual checksums | |
| echo "=== SHA256 Checksums ===" > checksums.txt | |
| cat *.sha256 >> checksums.txt | |
| echo "" >> checksums.txt | |
| # Generate combined checksum files | |
| sha256sum *.tar.gz > SHA256SUMS | |
| # Display what we're releasing | |
| echo "📦 Release artifacts:" | |
| ls -la | |
| - name: Read Changelog | |
| id: read_changelog | |
| run: | | |
| echo "Extracting latest changelog entry..." | |
| CHANGELOG=$(awk '/^## \[/{if (found++) exit} found {print}' changelog.md) | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: v${{ env.VERSION }} | |
| draft: ${{ inputs.draft }} | |
| prerelease: ${{ inputs.prerelease }} | |
| body: ${{ steps.read_changelog.outputs.changelog }} | |
| files: | | |
| release-assets/*.tar.gz | |
| release-assets/*.tar.gz.sha256 | |
| release-assets/SHA256SUMS | |
| release-assets/checksums.txt | |
| generate_release_notes: true | |
| cleanup: | |
| name: Cleanup old artifacts | |
| needs: release | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Delete artifacts | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-* | |
| failOnError: false |