From 9c7c3c4b6952fad7ba042b2e4cacc9f3785b70ab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 9 Nov 2025 10:26:41 +0000 Subject: [PATCH 1/3] Initial plan From 30d0244a51fd3d6bc274e5e4126c2dae75b646db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 9 Nov 2025 10:28:47 +0000 Subject: [PATCH 2/3] Initial exploration - understanding current workflow Co-authored-by: jbrixon <25202551+jbrixon@users.noreply.github.com> --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b672908..4dfaf10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "extensor-cache", "version": "1.1.3", - "license": "GPL-3.0-or-later", + "license": "MIT", "devDependencies": { "@babel/plugin-syntax-import-assertions": "^7.22.5", "@babel/preset-env": "^7.22.5", From ba2a7edc27009b822ef4ea14e10e9d1a6b3362e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 9 Nov 2025 10:30:05 +0000 Subject: [PATCH 3/3] Modify release workflow to check npm registry instead of git diff Co-authored-by: jbrixon <25202551+jbrixon@users.noreply.github.com> --- .github/workflows/release.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83ab70d..ec4ca87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,22 +18,16 @@ jobs: check-version: runs-on: ubuntu-latest outputs: - version-changed: ${{ steps.check.outputs.changed }} + should-publish: ${{ steps.check.outputs.should_publish }} new-version: ${{ steps.version.outputs.version }} steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Check if version changed - id: check - run: | - if git diff HEAD^ HEAD -- package.json | grep -q '"version"'; then - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "changed=false" >> $GITHUB_OUTPUT - fi + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' - name: Get version id: version @@ -41,14 +35,29 @@ jobs: VERSION=$(node -p "require('./package.json').version") echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Check if version exists on npm + id: check + run: | + PACKAGE_NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") + + # Check if the version exists on npm + if npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then + echo "Version $VERSION already published to npm. Skipping release." + echo "should_publish=false" >> $GITHUB_OUTPUT + else + echo "Version $VERSION not found on npm. Proceeding with release." + echo "should_publish=true" >> $GITHUB_OUTPUT + fi + release-and-publish: needs: check-version # Only run the publish job when: # - the CI workflow run concluded successfully, # - it ran against the 'main' branch, and - # - package.json version changed. + # - the version is not already published to npm. if: >- - needs.check-version.outputs.version-changed == 'true' && + needs.check-version.outputs.should-publish == 'true' && github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main'