Skip to content

Commit

Permalink
Updates to publish package workflow, remove npm cache should not be n…
Browse files Browse the repository at this point in the history
…ecessary for this step, improve slack messaging and only send when package was successfully published
  • Loading branch information
rushby committed Oct 29, 2024
1 parent 42aad36 commit 39c68df
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci-publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
SEED_PHRASE_6: ${{ secrets.SEED_PHRASE_6 }}
SEED_PHRASE_7: ${{ secrets.SEED_PHRASE_7 }}
SEED_PHRASE_8: ${{ secrets.SEED_PHRASE_8 }}
outputs:
build-directory: ${{ steps.upload_build.outputs.build_directory }}

steps:
- name: Checkout code
Expand All @@ -40,6 +38,10 @@ jobs:
- name: Run tests
run: npm run test

- name: Extract Package Version
id: extract_version
run: echo "package_version=$(jq -r '.version' package.json)" >> $GITHUB_ENV

- name: Upload build artifacts
id: upload_build
uses: actions/upload-artifact@v4
Expand All @@ -63,18 +65,18 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'

- name: Authenticate to npm registry
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc

- name: Publish to npm
id: publish
run: npm publish

- name: Send Slack Notification for Publish
if: ${{ !cancelled() }}
if: steps.publish.outcome == 'success'
uses: slackapi/[email protected]
with:
payload: |
Expand All @@ -84,7 +86,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*zkVerifyJS Package Published*\n\n*Build URL:* <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to view the build>"
"text": "*:tada: :zk-logo-icon-square-black: zkVerifyJS Package Published :zk-logo-icon-square-black: :tada:*\n\n*Build URL:* <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to view the build>\n\n*Published Package:* <https://www.npmjs.com/package/zkverifyjs/v/${{ env.package_version }}|zkverifyjs@${{ env.package_version }}>"
}
}
]
Expand Down

0 comments on commit 39c68df

Please sign in to comment.