Commit 3ab41fd9996f7bc82446d5c75a58d053ebddf70e Parent: 098a0ef6759de72d427b0fd0f090d3291a7a3407 Author: Matt Colligan <mcol@posteo.net> Date: 2026-08-30 20:57:53 +0100 Committer: GitHub <noreply@github.com> Committed: 2026-08-30 20:57:53 +0100 Add GitHub Actions workflow to publish release binaries (#28) * Add GitHub Actions workflow to publish release binaries Builds a release binary with Stack (the project's actual build tool, per stack.yaml/stack.yaml.lock) on every push to master, strips it, and publishes it as a GitHub Release asset named gitja-linux-x86_64. The version tag is derived from the cabal file's version field; if a release for that tag already exists (no version bump), the existing tag/release is updated in place instead of failing. PR builds run the same build step for validation but skip the publish step. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Remove explanatory comment from release workflow Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Make release workflow push-only ci.yaml already builds and tests this project on PRs; running an extra release build there was redundant, so trigger release.yaml only on push to master. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Use haskell-actions/setup (renamed from haskell/actions/setup) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Create a new release per push instead of overwriting Every push to master now gets its own GitHub Release: the cabal version is used as the tag, falling back to a short-SHA suffix when that tag already exists (no version bump), instead of editing the prior release in place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Update deprecated actions in ci.yaml actions/cache@v2 was failing CI as a deprecated/shut-down version; also bump actions/checkout to v4 and switch to the renamed haskell-actions/setup@v4 (from haskell/actions/setup@v1) for consistency with release.yaml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v * Fix haskell-actions/setup version pin v4 doesn't exist for the renamed haskell-actions/setup repo; its latest major tag is v2 (currently 2.9.1). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyGjWEMRv9qKWKmXJfgW7v --------- Co-authored-by: Claude <noreply@anthropic.com>
.github/workflows/release.yaml Added
@@ -0,0 +1,62 @@ +name: Release + +on: + push: + branches: [ master ] + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: haskell-actions/setup@v2 + with: + enable-stack: true + + - uses: actions/cache@v4 + with: + path: | + ~/.stack + .stack-work + key: ${{ runner.os }}-stack-release-${{ hashFiles('stack.yaml.lock', 'gitja.cabal') }} + restore-keys: | + ${{ runner.os }}-stack-release- + + - name: Build release binary + run: | + stack build --ghc-options="-O2" --copy-bins --local-bin-path ./dist + + - name: Strip binary + run: | + strip ./dist/gitja + mv ./dist/gitja ./dist/gitja-linux-x86_64 + + - name: Determine version + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=$(grep -m1 '^version:' gitja.cabal | awk '{print $2}') + TAG="v${VERSION}" + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + # Version wasn't bumped since the last release: disambiguate with + # the short SHA so this commit still gets its own release. + TAG="${TAG}-$(git rev-parse --short HEAD)" + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + + - name: Create release + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.version.outputs.tag }} + run: | + gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \ + --title "$TAG" --generate-notes + gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" \ + ./dist/gitja-linux-x86_64
.github/workflows/ci.yaml Modified
@@ -14,16 +14,16 @@ runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # Fetch all branches and tags so the tests can see them. fetch-depth: 0 - - uses: haskell/actions/setup@v1 + - uses: haskell-actions/setup@v2 with: enable-stack: true - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: ~/.stack/ key: ${{ runner.os }}-${{ hashFiles('**/stack.yaml.lock') }}