Skip to content

Merge pull request #91 from benbernard/issue-cleanups #4

Merge pull request #91 from benbernard/issue-cleanups

Merge pull request #91 from benbernard/issue-cleanups #4

Workflow file for this run

name: Release
on:
push:
branches:
- master
permissions:
contents: write
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint
- name: Type check
run: bun run typecheck
- name: Test
run: bun test
- name: Check documentation
run: bun run check-docs
determine-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine next version
id: version
run: |
# Get the latest version tag (e.g., v0.2.0)
LATEST_TAG=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
if [ -z "$LATEST_TAG" ]; then
# No tags exist — use package.json version as the starting point
CURRENT=$(jq -r .version package.json)
echo "No existing tags found, using package.json version: $CURRENT"
else
# Strip the leading 'v'
CURRENT="${LATEST_TAG#v}"
echo "Latest tag: $LATEST_TAG (version: $CURRENT)"
fi
# Bump patch version: split on dots, increment the last segment
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
NEXT_TAG="v${NEXT_VERSION}"
echo "Next version: $NEXT_VERSION (tag: $NEXT_TAG)"
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$NEXT_TAG" >> "$GITHUB_OUTPUT"
build:
needs: [ci, determine-version]
strategy:
matrix:
include:
- target: bun-linux-x64
artifact: recs-linux-x64
os: ubuntu-latest
- target: bun-linux-arm64
artifact: recs-linux-arm64
os: ubuntu-latest
- target: bun-darwin-x64
artifact: recs-darwin-x64
os: macos-latest
- target: bun-darwin-arm64
artifact: recs-darwin-arm64
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Stamp version in package.json
run: |
jq '.version = "${{ needs.determine-version.outputs.version }}"' package.json > package.json.tmp
mv package.json.tmp package.json
- name: Build binary
run: bun build ./bin/recs.ts --compile --target=${{ matrix.target }} --outfile=${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
release:
needs: [determine-version, build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create tag
run: |
git tag "${{ needs.determine-version.outputs.tag }}"
git push origin "${{ needs.determine-version.outputs.tag }}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.determine-version.outputs.tag }}
name: ${{ needs.determine-version.outputs.tag }}
generate_release_notes: true
files: |
artifacts/recs-linux-x64/recs-linux-x64
artifacts/recs-linux-arm64/recs-linux-arm64
artifacts/recs-darwin-x64/recs-darwin-x64
artifacts/recs-darwin-arm64/recs-darwin-arm64