Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm

# Guard: the pushed tag must match package.json version, because
# build-release.mjs derives the zip name and module.json download URL
# from package.json. A mismatch would publish a broken download link.
- name: Verify tag matches package.json version
env:
REF_NAME: ${{ github.ref_name }}
run: |
TAG="${REF_NAME#v}"
PKG="$(node -p "require('./package.json').version")"
echo "Tag version: $TAG"
echo "package.json: $PKG"
if [ "$TAG" != "$PKG" ]; then
echo "::error::Tag $REF_NAME does not match package.json version $PKG"
exit 1
fi

- run: npm ci

# check ends with `vite build`, producing dist/; package zips it.
- run: npm run check
- run: npm run package

- name: Determine prerelease flag
id: prerelease
env:
REF_NAME: ${{ github.ref_name }}
run: |
case "$REF_NAME" in
*-rc*|*-beta*|*-alpha*) echo "value=true" >> "$GITHUB_OUTPUT" ;;
*) echo "value=false" >> "$GITHUB_OUTPUT" ;;
esac

# Pull just this version's section out of CHANGELOG.md for the release body.
- name: Extract changelog section
env:
REF_NAME: ${{ github.ref_name }}
run: |
VERSION="${REF_NAME#v}"
awk -v header="## v${VERSION}" '
$0 == header { found = 1; next }
found && /^## v/ { exit }
found { print }
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "No changelog section for v${VERSION}; falling back to full changelog."
cp CHANGELOG.md release-notes.md
fi

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Grim Arithmetic ${{ github.ref_name }}
body_path: release-notes.md
prerelease: ${{ steps.prerelease.outputs.value == 'true' }}
files: |
releases/grim-arithmetic-${{ github.ref_name }}.zip
releases/module.json
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test

on:
push:
branches: [main]
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm

- run: npm ci

# Chains eslint + vitest + vite build (see package.json "check").
- run: npm run check
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
node_modules/
coverage/
dist/
docs/
plans/
docs/plans/
releases/
screenshots/
.DS_Store
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ npm install
npm run check # eslint + vitest + vite build
npm run package # build the release zip
```

## Author

Kyle Travis — [kyletravis.com](https://kyletravis.com) · [@kyletravis](https://x.com/kyletravis)
1 change: 0 additions & 1 deletion dist/assets/simulation.worker-ChHnUOCM.js

This file was deleted.

Loading