Publish Package to npmjs #7
Workflow file for this run
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_dispatch: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Set publishing config | |
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Read package version | |
id: package_version | |
run: echo "VERSION=$(jq -r .version < package.json)" >> $GITHUB_ENV | |
- name: Determine prerelease tag | |
id: prerelease_check | |
run: | | |
if [[ "${{ env.VERSION }}" =~ \-(alpha|beta)\.[0-9]+$ ]]; then | |
echo "PRERELEASE=--tag beta" >> $GITHUB_ENV | |
else | |
echo "PRERELEASE=" >> $GITHUB_ENV | |
fi | |
- run: pnpm install | |
- run: pnpm build | |
- run: pnpm publish --no-git-checks ${{ env.PRERELEASE }} |