From 69d555ef97ef0737e047e30ba4be138f0d34da83 Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Tue, 24 Feb 2026 17:17:58 +0100 Subject: [PATCH 1/2] ci: automate release tagging and npm publish --- .github/workflows/ci.yml | 40 +++++++++++++++++++ .github/workflows/publish.yml | 49 +++++++++++++++++++++++ .github/workflows/release-tag.yml | 66 +++++++++++++++++++++++++++++++ README.md | 27 +++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release-tag.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f185259 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm lint + + - name: Typecheck + run: pnpm typecheck + + - name: Build + run: pnpm build + + - name: Test + run: pnpm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b452884 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: Publish to npm + +on: + push: + tags: + - "v*" + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm lint + + - name: Typecheck + run: pnpm typecheck + + - name: Build + run: pnpm build + + - name: Test + run: pnpm test + + - name: Publish package + run: npm publish --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 0000000..02fbd0e --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,66 @@ +name: Release Tag + +on: + workflow_dispatch: + inputs: + bump: + description: Version bump type + required: true + default: patch + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Ensure main branch + run: test "${{ github.ref_name }}" = "main" + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Verify (lint, typecheck, build, test) + run: | + pnpm lint + pnpm typecheck + pnpm build + pnpm test + + - name: Configure git author + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Bump version and create tag + id: bump + run: | + NEW_VERSION=$(npm version ${{ github.event.inputs.bump }} -m "chore(release): %s [skip ci]") + echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" + + - name: Push release commit and tag + run: git push origin HEAD:${{ github.ref_name }} --follow-tags + + - name: Release summary + run: echo "Created and pushed ${{ steps.bump.outputs.version }}" diff --git a/README.md b/README.md index ad34f0c..6696324 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,33 @@ codebase-visualizer - File + exported function granularity (no internal function calls) - Client-side 3D requires WebGL +## Release + +Publishing is automated and **only happens on `v*` tags**. + +### One-time setup + +1. Create an npm automation token (npmjs.com → Access Tokens). +2. Add it to GitHub repository secrets as `NPM_TOKEN`. + +### Normal CI (before release) + +- `CI` workflow runs on every PR and push to `main`: + - lint → typecheck → build → test + +### Create a release (auto bump + auto tag) + +1. Open GitHub Actions → `Release Tag`. +2. Click **Run workflow** on `main`. +3. Select bump type: `patch` | `minor` | `major`. + +`Release Tag` will: +- run lint → typecheck → build → test +- bump `package.json` version +- create and push `vX.Y.Z` tag + +Pushing that tag triggers `Publish to npm`, which runs checks again and publishes. + ## Contributing Contributions are welcome. Please open an issue first to discuss what you'd like to change. From 94b2d27d8fa96c98e8c8b988ba4dd2b16cf43b9c Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Tue, 24 Feb 2026 17:20:47 +0100 Subject: [PATCH 2/2] ci: align pnpm version with packageManager --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/release-tag.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f185259..2ae7396 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.28.2 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b452884..c96ac80 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,7 +19,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.28.2 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 02fbd0e..5fdd131 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -30,7 +30,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.28.2 - name: Setup Node.js uses: actions/setup-node@v4