Skip to content

Publish Package to npmjs #4

Publish Package to npmjs

Publish Package to npmjs #4

Workflow file for this run

name: Publish Package to npmjs
on:
workflow_call:
workflow_dispatch:
jobs:
publish:
runs-on: ["self-hosted", "org", "npm-publish"]
permissions:
contents: write
id-token: write
pull-requests: write
repository-projects: write
steps:
- name: Get GitHub Token from Akeyless
id: get_github_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
dynamic-secrets: '{"/dynamic-secrets/keys/github/compliance/contents=write,pull_requests=write":"PAT"}'
- 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/checkout@v4
with:
token: ${{ env.PAT }}
- uses: actions/setup-node@v3
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
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 }}