From 2a4eff41c747faa37d8e2a391b047f1beb09a8f3 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 15 Aug 2025 18:26:06 +0100 Subject: [PATCH 1/3] chore(pkg): add changeset scripts for versioning and release management --- package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package.json b/package.json index 2dd802d1d..8d13cd68a 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,16 @@ "version": "0.0.1", "license": "MIT", "scripts": { + "changeset": "changeset", + "changeset:version": "changeset version", + "changeset:publish": "changeset publish", + "release:alpha": "changeset publish --tag alpha", + "release:beta": "changeset publish --tag beta", + "release": "changeset publish", + "version": "changeset version && bun run go", + "check:affected": "nx show projects --affected --uncommitted", + "prerelease:enter": "changeset pre enter alpha", + "prerelease:exit": "changeset pre exit", "reset": "bun unlink-all && rimraf dist node_modules doc tmp yarn-error.log yarn.lock package-lock.json bun.lockb learn-debug.log tmp .nx lit-auth-storage pkp-tokens lit-auth-local ./e2e/dist ./e2e/node_modules", "go": "bun run build && bun link-all", "build": "bun unlink-all && bun scripts/auto-fix-deps.mjs && nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions && bun run prettier", From 61401b5d64dc3afb442153dd0bbc84b2f0519323 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 15 Aug 2025 18:56:32 +0100 Subject: [PATCH 2/3] chore(release): update base branch to 'naga' and add GitHub Actions workflow for automated releases --- .changeset/config.json | 2 +- .github/workflows/release.yml | 131 ++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.changeset/config.json b/.changeset/config.json index c012f3d1d..403c6980f 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -5,7 +5,7 @@ "fixed": [], "linked": [], "access": "public", - "baseBranch": "main", + "baseBranch": "naga", "updateInternalDependencies": "minor", "ignore": [] } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..7f18c6e07 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,131 @@ +name: Release + +on: + push: + branches: + - main + - master + - naga + - 'feature/**' + pull_request: + branches: + - main + - master + - naga + workflow_dispatch: + inputs: + release_type: + description: 'Release type' + required: true + default: 'alpha' + type: choice + options: + - alpha + - beta + - latest + +env: + LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }} + LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }} + LIVE_MASTER_ACCOUNT: ${{ secrets.LIVE_MASTER_ACCOUNT }} + LOCAL_MASTER_ACCOUNT: ${{ secrets.LOCAL_MASTER_ACCOUNT }} + LOG_LEVEL: info + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + +jobs: + test-and-release: + runs-on: ubuntu-latest + environment: Health Check + timeout-minutes: 30 + if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install rust + uses: dtolnay/rust-toolchain@1.76.0 + + - name: Install wasm-pack + uses: jetli/wasm-pack-action@v0.4.0 + with: + version: 'latest' + + - name: Setup Node for NPM + uses: actions/setup-node@v4 + with: + node-version: '18' + registry-url: 'https://registry.npmjs.org' + + - name: Install Bun dependencies + run: bun install + + - name: Build project + run: bun run build + + - name: Run health check for naga-dev + run: NETWORK=naga-dev bun run test:e2e all --timeout 5000000 + timeout-minutes: 10 + + - name: Run health check for naga-test + run: NETWORK=naga-test bun run test:e2e all --timeout 5000000 + timeout-minutes: 10 + + - name: Run health check for naga-staging + run: NETWORK=naga-staging bun run test:e2e all --timeout 5000000 + timeout-minutes: 10 + + # Release logic - only on push to main/naga branches (not PRs or feature branches) + - name: Check release conditions + id: release-check + if: github.event_name == 'push' && (github.ref == 'refs/heads/naga' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') + run: | + echo "branch-eligible=true" >> $GITHUB_OUTPUT + echo "✅ Branch is eligible for release" + + - name: Check for changesets + id: changesets + if: steps.release-check.outputs.branch-eligible == 'true' || github.event_name == 'workflow_dispatch' + uses: changesets/action@v1 + with: + version: echo "Checking for changesets..." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release Beta (naga branch) + if: steps.changesets.outputs.hasChangesets == 'true' && github.ref == 'refs/heads/naga' + run: | + echo "🚀 Publishing alpha release for naga branch" + bun run changeset pre enter beta + bun run changeset version + + # This will probably fail because we have already entered `beta` mode, but let this fail and + # see if it works so that we don't accidentally publish to `latest` + bun run changeset publish --tag beta + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Release Stable (main/master branch) + if: steps.changesets.outputs.hasChangesets == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') + run: | + echo "🚀 Publishing stable release for main branch" + bun run changeset pre exit + bun run changeset version + bun run changeset publish + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: No changesets found + if: (steps.release-check.outputs.branch-eligible == 'true' || github.event_name == 'workflow_dispatch') && steps.changesets.outputs.hasChangesets != 'true' + run: | + echo "â„šī¸ No changesets found - nothing to release" + echo "To create a release, add changesets with: bun run changeset" + echo "This is normal for documentation updates, refactoring, or other non-package changes" From 67fa22c3008b347f3961ce59601705f88543c8a2 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 15 Aug 2025 19:06:07 +0100 Subject: [PATCH 3/3] feat(release): add manual release step to GitHub Actions workflow for versioning --- .github/workflows/release.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f18c6e07..2cbacb0b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,6 +123,22 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Manual Release (workflow_dispatch) + if: steps.changesets.outputs.hasChangesets == 'true' && github.event_name == 'workflow_dispatch' + run: | + echo "🚀 Publishing manual release with tag: ${{ github.event.inputs.release_type }}" + if [ "${{ github.event.inputs.release_type }}" != "latest" ]; then + bun run changeset pre enter ${{ github.event.inputs.release_type }} + bun run changeset version + bun run changeset publish --tag ${{ github.event.inputs.release_type }} + else + bun run changeset pre exit + bun run changeset version + bun run changeset publish + fi + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: No changesets found if: (steps.release-check.outputs.branch-eligible == 'true' || github.event_name == 'workflow_dispatch') && steps.changesets.outputs.hasChangesets != 'true' run: |