From 1f452811d8aa83983b12a7d2607bd1f1a6c9d77c Mon Sep 17 00:00:00 2001 From: Hyeoncheol Kim Date: Tue, 24 Feb 2026 17:42:26 +0900 Subject: [PATCH 1/2] ci(node): add npm release workflow draft and checklist gate (#111) --- .github/workflows/npm-node-release.yml | 101 +++++++++++++++++++++++++ docs/RELEASE_CHECKLIST.md | 10 +++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/npm-node-release.yml diff --git a/.github/workflows/npm-node-release.yml b/.github/workflows/npm-node-release.yml new file mode 100644 index 0000000..dc5bcaa --- /dev/null +++ b/.github/workflows/npm-node-release.yml @@ -0,0 +1,101 @@ +name: Node Adapter Release + +on: + workflow_dispatch: + inputs: + version: + description: "Node package version (required for manual publish)" + required: false + type: string + publish: + description: "Publish to npm (false runs dry-run only)" + required: false + default: false + type: boolean + push: + tags: + - "node-v*.*.*" + +permissions: + contents: read + id-token: write + +jobs: + verify: + name: Verify Node package + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + + - name: Install workspace dependencies + run: npm ci + + - name: Build + run: npm run node:build + + - name: Typecheck + run: npm run node:typecheck + + - name: Test + run: npm run node:test + + publish: + name: Publish Node package + needs: verify + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + registry-url: "https://registry.npmjs.org" + + - name: Install workspace dependencies + run: npm ci + + - name: Resolve release version + id: meta + shell: bash + run: | + if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then + VERSION="${GITHUB_REF_NAME#node-v}" + else + VERSION="${{ inputs.version }}" + fi + + if [[ -z "$VERSION" ]]; then + echo "No version input provided. Publish job will run in dry-run mode." + elif [[ "$VERSION" == *"-SNAPSHOT" ]]; then + echo "Version must not end with -SNAPSHOT: $VERSION" + exit 1 + fi + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Set package version for release job + if: steps.meta.outputs.version != '' + run: npm version "${{ steps.meta.outputs.version }}" --workspace @jongodb/memory-server --no-git-tag-version + + - name: npm publish dry-run + run: npm publish --workspace @jongodb/memory-server --access public --provenance --dry-run + + - name: npm publish + if: env.NPM_TOKEN != '' && (github.event_name == 'push' || inputs.publish) + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --workspace @jongodb/memory-server --access public --provenance diff --git a/docs/RELEASE_CHECKLIST.md b/docs/RELEASE_CHECKLIST.md index b8c5f24..df53678 100644 --- a/docs/RELEASE_CHECKLIST.md +++ b/docs/RELEASE_CHECKLIST.md @@ -31,6 +31,16 @@ Before creating a release tag: 5. Push the release tag (`git tag -a vX.Y.Z -m "jongodb X.Y.Z"` then `git push origin vX.Y.Z`). 6. Confirm `.github/workflows/maven-central-release.yml` completed and a GitHub Release exists for the tag. +## Node Adapter Release Gate (Draft) + +Use this when publishing `@jongodb/memory-server`: + +1. Confirm `Node Adapter Release` workflow verify job is green. +2. Confirm package version is set explicitly (tag `node-vX.Y.Z` or manual input). +3. Run `npm publish --dry-run` and review package contents. +4. Publish only when `NPM_TOKEN` is configured and verify npm registry visibility. +5. Update README usage examples with the released package version. + ## Release History | Version | Date (UTC) | Commit | Maven | GitHub Actions | From 9d0ba791d08179c298f21726fb0ab2b45fae2b76 Mon Sep 17 00:00:00 2001 From: Hyeoncheol Kim Date: Tue, 24 Feb 2026 17:47:49 +0900 Subject: [PATCH 2/2] fix(node-release): require explicit version for manual publish (#111) --- .github/workflows/npm-node-release.yml | 18 +++++++++++++++--- docs/RELEASE_CHECKLIST.md | 7 ++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm-node-release.yml b/.github/workflows/npm-node-release.yml index dc5bcaa..b771b34 100644 --- a/.github/workflows/npm-node-release.yml +++ b/.github/workflows/npm-node-release.yml @@ -20,6 +20,10 @@ permissions: contents: read id-token: write +concurrency: + group: node-release-${{ github.ref }} + cancel-in-progress: false + jobs: verify: name: Verify Node package @@ -72,19 +76,27 @@ jobs: id: meta shell: bash run: | + PUBLISH_INPUT="${{ inputs.publish }}" + if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then VERSION="${GITHUB_REF_NAME#node-v}" else VERSION="${{ inputs.version }}" fi - if [[ -z "$VERSION" ]]; then - echo "No version input provided. Publish job will run in dry-run mode." - elif [[ "$VERSION" == *"-SNAPSHOT" ]]; then + if [[ "$VERSION" == *"-SNAPSHOT" ]]; then echo "Version must not end with -SNAPSHOT: $VERSION" exit 1 fi + if [[ -z "$VERSION" ]]; then + if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "$PUBLISH_INPUT" == "true" ]]; then + echo "Manual publish requires an explicit version input." + exit 1 + fi + echo "No version input provided. Publish job will run in dry-run mode." + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" - name: Set package version for release job diff --git a/docs/RELEASE_CHECKLIST.md b/docs/RELEASE_CHECKLIST.md index df53678..7dbb4ab 100644 --- a/docs/RELEASE_CHECKLIST.md +++ b/docs/RELEASE_CHECKLIST.md @@ -37,9 +37,10 @@ Use this when publishing `@jongodb/memory-server`: 1. Confirm `Node Adapter Release` workflow verify job is green. 2. Confirm package version is set explicitly (tag `node-vX.Y.Z` or manual input). -3. Run `npm publish --dry-run` and review package contents. -4. Publish only when `NPM_TOKEN` is configured and verify npm registry visibility. -5. Update README usage examples with the released package version. +3. For manual workflow runs, never set `publish=true` with empty `version` (workflow blocks this). +4. Run `npm publish --dry-run` and review package contents. +5. Publish only when `NPM_TOKEN` is configured and verify npm registry visibility. +6. Update README usage examples with the released package version. ## Release History