Skip to content

Dispatch publish release #8

Dispatch publish release

Dispatch publish release #8

Workflow file for this run

name: Dispatch publish release
on:
workflow_dispatch:
inputs:
package:
type: choice
description: 'Package to release'
required: true
options:
- core
- embed
level:
type: choice
description: Select the release update level
options:
- major
- minor
- patch
- prerelease
- premajor
- preminor
- prepatch
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@v2
- name: πŸ”§ Git
run: |
git config user.email "[email protected]"
git config user.name "Github InternetIdentityLabs"
- name: πŸ”§ Node
uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: πŸ”§ Yarn
run: |
yarn config set version-git-message "chore(${{ github.event.inputs.package }}): release v%s"
yarn config set version-tag-prefix "@nfid/${{ github.event.inputs.package }}-v"
- name: πŸ€– Install
run: yarn
- name: πŸ€– Increment package version
working-directory: packages/${{ github.event.inputs.package }}
run: |
if [[ ${{ github.event.inputs.level }} == "pre"* ]]; then
yarn version --${{ github.event.inputs.level }} --preid ${{ github.event.inputs.preid }}
else
yarn version --${{ github.event.inputs.level }}
fi
- name: πŸ€– Build
run: npx nx build ${{ github.event.inputs.package }}
- name: πŸ“¦ Publish package to NPM registry
if: ${{ github.event.inputs.registry == 'npm' }}
working-directory: dist/packages/${{ github.event.inputs.package }}
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.IL_GH_NPM_TOKEN }}
- name: πŸ“¦ Publish package to github-packages registry
if: ${{ github.event.inputs.registry == 'github-packages' }}
working-directory: dist/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
run: |
git push
git push --tags