Merge pull request #61 from m0n0x41d/dev #34
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*'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| tui-bundle: | |
| name: Build TUI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Build TUI bundle | |
| run: cd tui && rm -rf node_modules package-lock.json && npm install --no-audit --no-fund && npm run build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: tui-bundle | |
| path: tui/dist/tui.mjs | |
| test: | |
| name: Pre-release tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| cache-dependency-path: go.sum | |
| - name: Prepare desktop embed placeholder | |
| run: | | |
| mkdir -p desktop/frontend/dist | |
| printf 'ci placeholder\n' > desktop/frontend/dist/.ci-placeholder | |
| - name: Run tests | |
| run: go test -race $(go list ./... | grep -v /desktop) | |
| build: | |
| name: Build ${{ matrix.goos }}-${{ matrix.goarch }} | |
| needs: [test, tui-bundle] | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - { runner: ubuntu-latest, goos: linux, goarch: amd64 } | |
| - { runner: ubuntu-24.04-arm, goos: linux, goarch: arm64 } | |
| - { runner: macos-latest, goos: darwin, goarch: arm64 } | |
| - { runner: macos-latest, goos: darwin, goarch: amd64 } | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| cache-dependency-path: go.sum | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Prepare desktop embed | |
| run: | | |
| cd desktop/frontend | |
| rm -rf node_modules package-lock.json | |
| npm install --no-audit --no-fund | |
| npm run build | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: tui-bundle | |
| path: tui/dist | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: '1' | |
| run: | | |
| go build -trimpath \ | |
| -ldflags "-s -w \ | |
| -X github.com/m0n0x41d/haft/internal/cli.Version=${{ steps.version.outputs.version }} \ | |
| -X github.com/m0n0x41d/haft/internal/cli.Commit=$(git rev-parse --short HEAD) \ | |
| -X github.com/m0n0x41d/haft/internal/cli.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ | |
| -o haft ./cmd/haft/ | |
| - name: Package | |
| run: | | |
| mkdir -p _dist | |
| cp tui/dist/tui.mjs . | |
| tar czf _dist/haft-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \ | |
| haft tui.mjs README.md LICENSE CHANGELOG.md | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: haft-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: _dist/*.tar.gz | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: _artifacts | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: cd _artifacts && sha256sum *.tar.gz > checksums.txt | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| --title "Haft ${{ github.ref_name }}" \ | |
| --generate-notes \ | |
| _artifacts/* |