From 5a6079f160f6e9a588a175812dd7f1ca409dd046 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Tue, 28 Apr 2026 15:51:33 +0200 Subject: [PATCH 1/2] ci: only publish if the version changed (= if the version is not published yet) --- .github/workflows/ci.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 10da471..c45ad56 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,6 @@ on: branches: - main pull_request: - workflow_dispatch: null jobs: build: runs-on: ubuntu-latest @@ -23,7 +22,20 @@ jobs: registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm run prepublishOnly - - run: npm publish --access public + - name: Check if version is already published + id: version-check if: github.event_name != 'pull_request' + run: | + PKG_NAME=$(node -p "require('./package.json').name") + PKG_VERSION=$(node -p "require('./package.json').version") + if npm view "$PKG_NAME@$PKG_VERSION" version > /dev/null 2>&1; then + echo "Version $PKG_VERSION of $PKG_NAME is already published, skipping publish." + echo "should-publish=false" >> "$GITHUB_OUTPUT" + else + echo "Version $PKG_VERSION of $PKG_NAME is new, will publish." + echo "should-publish=true" >> "$GITHUB_OUTPUT" + fi + - run: npm publish --access public + if: github.event_name != 'pull_request' && steps.version-check.outputs.should-publish == 'true' env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 922ad78f1f35c6c97b08316ef427fde83e85c93b Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Tue, 28 Apr 2026 15:51:59 +0200 Subject: [PATCH 2/2] chore: restore manual trigger --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c45ad56..4c4f575 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: branches: - main pull_request: + workflow_dispatch: jobs: build: runs-on: ubuntu-latest