Skip to content

Update hero headline: Talk to your terminal. In plain English. #76

Update hero headline: Talk to your terminal. In plain English.

Update hero headline: Talk to your terminal. In plain English. #76

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Type check
run: bun run typecheck
- name: Build
run: bun run build
- name: Verify build output
run: |
test -f dist/index.js || exit 1
test -f dist/cli.js || exit 1
shell: bash
website:
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Build
run: npm run build
# Auto-create version tag when package.json version changes on main
auto-tag:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Check for version change
id: version
run: |
# Get current version from package.json
CURRENT_VERSION=$(jq -r '.version' package.json)
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
# Get previous version from the commit before
git show HEAD~1:package.json > /tmp/prev-package.json 2>/dev/null || echo '{"version":"0.0.0"}' > /tmp/prev-package.json
PREV_VERSION=$(jq -r '.version' /tmp/prev-package.json)
echo "previous=$PREV_VERSION" >> $GITHUB_OUTPUT
# Check if version changed
if [ "$CURRENT_VERSION" != "$PREV_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed: $PREV_VERSION -> $CURRENT_VERSION"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version unchanged: $CURRENT_VERSION"
fi
- name: Check if tag exists
if: steps.version.outputs.changed == 'true'
id: tag-check
run: |
TAG="v${{ steps.version.outputs.current }}"
if git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag $TAG already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag $TAG does not exist"
fi
- name: Create and push tag
if: steps.version.outputs.changed == 'true' && steps.tag-check.outputs.exists == 'false'
run: |
TAG="v${{ steps.version.outputs.current }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
echo "Created and pushed tag: $TAG"
echo "This tag push will automatically trigger the Release workflow"