π Publish: 2. Publish to NPM (automatic) #299
This file contains hidden or 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: 2. Publish to NPM (automatic)' | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| workflow_call: | |
| secrets: | |
| PUBLISH_NPM: | |
| required: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Setup and Build | |
| uses: ./.github/actions/install-build | |
| - name: Version | |
| id: version | |
| run: | | |
| echo "VERSION=$(jq .version lerna.json)" >> $GITHUB_OUTPUT | |
| - name: DIST_TAG | |
| id: dist_tag | |
| uses: streetsidesoftware/actions/public/output@v1 | |
| with: | |
| value: ${{ contains(steps.version.outputs.VERSION, 'alpha') && '--dist-tag next' || '' }} | |
| # See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package | |
| - name: Publish to NPM | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM}} | |
| NPM_CONFIG_PROVENANCE: true | |
| # TODO: support --sign-git-tag --sign-git-commit | |
| run: | | |
| pnpm lerna publish from-package --no-push --no-private --yes ${{ steps.dist_tag.outputs.value }} | |
| - name: Summary | |
| uses: streetsidesoftware/actions/public/summary@v1 | |
| with: | |
| text: | | |
| # Publish Results | |
| - Version: ${{ steps.version.outputs.VERSION }} | |
| - Dist Tag: `${{ steps.dist_tag.outputs.value }}` |