Skip to content

Release

Release #4

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (without v prefix)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
VERSION: ${{ github.event.inputs.version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: jetify-com/devbox-install-action@22b0f5500b14df4ea357ce673fbd4ced940ed6a1 # v0.13.0
with:
enable-cache: "true"
# 1. Create draft release first (no git tag yet)
- name: Create draft release
run: |
gh release create "v$VERSION" \
--draft \
--title "v$VERSION" \
--notes "Release v$VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 2. Build binaries and upload to draft release
- name: Install dependencies
run: devbox run bun install --frozen-lockfile
- name: Build binaries
run: devbox run bun scripts/build.ts --version "$VERSION"
- name: Upload binaries to draft release
run: gh release upload "v$VERSION" dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 3. Calculate hashes and update flake.nix
- name: Update flake.nix with hashes
run: devbox run bun scripts/update-flake.ts --version "$VERSION" --dist-dir dist
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for gh cli that is used in the script internally
# 4. Update README.md with version
- name: Update README.md
run: devbox run bun scripts/update-readme.ts --version "$VERSION"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for gh cli that is used in the script internally
# 5. Commit flake.nix and README.md changes
- name: Commit updates
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add flake.nix README.md
git commit -m "chore: update flake.nix and README.md for v$VERSION"
# 6. Tag the commit and push
- name: Create and push tag
run: |
git tag -a "v$VERSION" -m "Release v$VERSION"
git push origin HEAD:main --tags
# 7. Update draft release to point to the new commit and publish
- name: Publish release
run: |
gh release edit "v$VERSION" --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}