From 4f2f4da56ba67e24fffb3af75f9e976b7f3e9169 Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Mon, 17 Nov 2025 14:24:38 +0100 Subject: [PATCH 1/3] fix: use github.run_number Signed-off-by: Ruben Romero Montes --- .github/workflows/integration.yml | 2 +- .github/workflows/publish.yml | 21 ++++++--------------- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index cfa623a..50ec85b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,4 +27,4 @@ jobs: with: language: javascript repo-url: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - commit-sha: ${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.event.pull_request.head.sha || github.sha }} + commit-sha: ${{ github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 93c6b9a..6c2b3ca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -58,14 +58,6 @@ jobs: # Remove both -ea. and -ea- formats for compatibility BASE_VERSION=$(echo "$VERSION" | sed -E 's/-ea[.-][0-9]+$//') echo "base-version=$BASE_VERSION" >> "$GITHUB_OUTPUT" - echo "current-version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Update package with EA version - id: bump - run: | - EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea-${{ github.run_number }}" - npm version "$EA_VERSION" --no-git-tag-version - echo "version=$EA_VERSION" >> "$GITHUB_OUTPUT" - name: Install project modules run: npm ci @@ -74,14 +66,13 @@ jobs: run: npm run compile - name: Publish package - run: npm publish --verbose --tag ea --access public --provenance - - - name: Commit and push package modifications run: | - git add package.json - git add package-lock.json - git commit -m "build: updated package with ${{ steps.bump.outputs.version }} [skip ci]" - git push + EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea-${{ github.run_number }}" + # Temporarily update version for publish + npm version "$EA_VERSION" --no-git-tag-version + npm publish --verbose --tag ea --access public --provenance + # Restore original version + npm version "${{ steps.current-version.outputs.base-version }}" --no-git-tag-version publish-release: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') diff --git a/package-lock.json b/package-lock.json index 5ef7b45..1aa1660 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@trustify-da/trustify-da-javascript-client", - "version": "0.2.4-ea.13", + "version": "0.2.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@trustify-da/trustify-da-javascript-client", - "version": "0.2.4-ea.13", + "version": "0.2.4", "license": "Apache-2.0", "dependencies": { "@babel/core": "^7.23.2", diff --git a/package.json b/package.json index 95a812e..de3902f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@trustify-da/trustify-da-javascript-client", - "version": "0.2.4-ea.13", + "version": "0.2.4", "description": "Code-Ready Dependency Analytics JavaScript API.", "license": "Apache-2.0", "homepage": "https://github.com/guacsec/trustify-da-javascript-client#README.md", From ab5487a96043fdae78b16aad1d9d87e84a69fa37 Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Mon, 17 Nov 2025 17:32:20 +0100 Subject: [PATCH 2/3] chore: use short sha for versioning Signed-off-by: Ruben Romero Montes --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c2b3ca..44d125d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,7 +67,8 @@ jobs: - name: Publish package run: | - EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea-${{ github.run_number }}" + SHORT_SHA=$(git rev-parse --short "${{ github.event.workflow_run.head_sha }}") + EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea.${SHORT_SHA}" # Temporarily update version for publish npm version "$EA_VERSION" --no-git-tag-version npm publish --verbose --tag ea --access public --provenance From 5305e3b339bf48faf9886c406906714b420c112e Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Mon, 17 Nov 2025 17:37:44 +0100 Subject: [PATCH 3/3] chore: skip publish on PR Signed-off-by: Ruben Romero Montes --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 44d125d..081f992 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,8 @@ jobs: publish-ea: if: | github.event_name == 'workflow_run' && - github.event.workflow_run.head_branch == 'main' + github.event.workflow_run.head_branch == 'main' && + github.event.workflow_run.event == 'push' runs-on: ubuntu-latest name: Publish EA release to NPM steps: