Publish Package to npmjs #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package to npmjs | |
on: | |
workflow_call: | |
inputs: | |
commit_hash: | |
description: "Commit to checkout and to publish" | |
required: true | |
type: string | |
workflow_dispatch: | |
inputs: | |
commit_hash: | |
description: "Commit to checkout and to publish" | |
required: true | |
type: string | |
jobs: | |
publish: | |
runs-on: ["self-hosted", "org", "npm-publish"] | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
repository-projects: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Get NPM Token from Akeyless | |
id: get_npmjs_token | |
uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest | |
with: | |
api-url: https://api.gateway.akeyless.celo-networks-dev.org | |
access-id: p-kf9vjzruht6l | |
static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
- run: npm install | |
- name: Compile typescript library | |
run: npm run build | |
- name: Bump version | |
id: bump_version | |
run: echo "NPM_VERSION=$(npm version patch --no-git-tag-version)" >> $GITHUB_OUTPUT | |
- name: Publish | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "auto: publish ${{ steps.bump_version.outputs.NPM_VERSION }}" | |
tagging_message: ${{ steps.bump_version.outputs.NPM_VERSION }} |