Skip to content

Dispatch NPM release #79

Dispatch NPM release

Dispatch NPM release #79

Workflow file for this run

name: Dispatch NPM release
permissions:
contents: "write"
on:
workflow_dispatch:
inputs:
package:
type: choice
description: "Package to release"
required: true
options:
- "identity-kit"
- "postmessage-rpc"
- "vaults"
level:
type: choice
description: Select the release update level
options:
- major
- minor
- patch
- prepatch
- preminor
- premajor
- prerelease
preid:
type: choice
required: false
description: Select pre-id (alpha | beta)
default: "none"
options:
- alpha
- beta
registry:
type: choice
required: false
description: Select registry
default: 'github-packages'
options:
- github-packages
- npm
jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.NFID_GITHUB_ACTION_GPG_KEY }}
passphrase: ${{ secrets.NFID_GITHUB_ACTION_GPG_KEY_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: πŸ”§ Git
run: |
git config user.email "nfid-github-action@identitylabs.ooo"
git config user.name "NFID Github Action"
- name: πŸ”§ Node
uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: πŸ”§ Yarn
run: |
npx yarn config set version-git-message "chore(${{ github.event.inputs.package }}): release v%s"
npx yarn config set version-tag-prefix "@nfid/${{ github.event.inputs.package }}-v"
- name: πŸ€– Install
run: npm i --frozen-lockfile
- name: πŸ€– Increment package version
working-directory: packages/${{ github.event.inputs.package }}
run: |
if [[ ${{ github.event.inputs.level }} == "pre"* ]]; then
npx yarn version --${{ github.event.inputs.level }} --preid ${{ github.event.inputs.preid }}
else
npx yarn version --${{ github.event.inputs.level }}
fi
- name: πŸ€– Build
run: npm run build-package @nfid/${{ github.event.inputs.package }}
- name: πŸ“¦ Publish package on NPM
if: ${{ github.event.inputs.registry == 'npm' }}
working-directory: packages/${{ github.event.inputs.package }}
run: npx yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.IL_GH_NPM_TOKEN }}
- name: πŸ“¦ Publish package on GPR
if: ${{ github.event.inputs.registry == 'github-packages' }}
working-directory: packages/${{ github.event.inputs.package }}
run: |
npm pkg set 'name'='@internet-identity-labs/${{ github.event.inputs.package }}'
echo "registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: πŸŽ‰ Push tags and commit with version increment
run: |
git push
git push --tags