From 5b2610da797b4826cb37dd8b221d1aa1bfa0ef9f Mon Sep 17 00:00:00 2001 From: Mathieu Chambaud Date: Thu, 29 Oct 2026 22:43:01 +0100 Subject: [PATCH] build: release with npm version and tagged GitHub releases Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ .npmrc | 1 + README.md | 12 ++++++++++++ package.json | 4 +++- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .npmrc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..78111d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: ['v*.*.*'] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check tag matches package.json + run: | + version="v$(node -p 'require("./package.json").version')" + if [ "$version" != "$GITHUB_REF_NAME" ]; then + echo "Tag $GITHUB_REF_NAME does not match package.json ($version)" >&2 + exit 1 + fi + - name: Create GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..6249b89 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +message="chore(release): v%s" diff --git a/README.md b/README.md index 039190b..1275cb8 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,15 @@ Questions about the SFU itself belong in The code is [MIT](LICENSE) © Mathieu Chambaud. The Lumyx name, logo and the assets in [`brand/`](brand) are not covered by the MIT license and may not be used to imply endorsement. + +## Releasing + +Versions follow [SemVer](https://semver.org/) and are cut from an up-to-date `main`: + +```sh +npm version patch # or minor / major +``` + +This runs the CI checks, bumps `package.json`, commits `chore(release): vX.Y.Z`, tags `vX.Y.Z` +and pushes. The tag triggers the Release workflow, which publishes a GitHub release with +generated notes. diff --git a/package.json b/package.json index 2dc947f..c80c376 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "lint": "turbo run lint", "check-types": "turbo run check-types", "test": "turbo run test", - "verify:ds": "turbo run verify:ds" + "verify:ds": "turbo run verify:ds", + "preversion": "test \"$(git branch --show-current)\" = main && git fetch -q origin main && test \"$(git rev-parse HEAD)\" = \"$(git rev-parse origin/main)\" && bun run lint && bun run check-types && bun run test && bun run verify:ds && bun run build", + "postversion": "git push --follow-tags" }, "devDependencies": { "turbo": "^2.10.12",