Publish to NPM #7
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 to NPM | |
concurrency: main | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
description: 'Package to publish' | |
required: true | |
default: 'all' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
fetch-depth: 0 | |
- name: Enable node | |
uses: actions/setup-node@master | |
with: | |
node-version: 18.x | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@wanews' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Install pnpm | |
run: | | |
npm i -g pnpm@8 | |
pnpm set verify-store-integrity false | |
- name: pnpm install | |
run: | | |
pnpm install --frozen-lockfile | |
- name: tsc | |
run: | | |
pnpm run build-tsc | |
- name: Package | |
run: | | |
if [ ${{ inputs.package }} == 'all' ]; then | |
pnpm package | |
else | |
pnpm nx run ${{ inputs.package }}:package | |
fi | |
- name: Release packages | |
uses: changesets/action@master | |
with: | |
publish: pnpm exec changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.SERVICE_ACCOUNT_PAT }} |