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..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: @@ -58,14 +59,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 +67,14 @@ 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 + 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 + # 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",