Merge pull request #305 from creativelifeform/release/12.1.0 #14
Workflow file for this run
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install packages | |
| run: npm install | |
| - name: Test source | |
| run: npm run test | |
| - name: Build source | |
| run: npm run build | |
| - name: Publish packages to npm registry | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" == *-* ]]; then | |
| # Prerelease (e.g. 12.0.0-alpha.0): route to a dist-tag derived from | |
| # the prerelease id so it never lands on `latest`. `npm publish` | |
| # WITHOUT --tag publishes to `latest` even for prerelease versions. | |
| PRERELEASE_ID="${VERSION#*-}" | |
| DIST_TAG="${PRERELEASE_ID%%.*}" | |
| echo "Publishing prerelease $VERSION under dist-tag '$DIST_TAG'" | |
| npm publish --access public --tag "$DIST_TAG" | |
| else | |
| echo "Publishing $VERSION under dist-tag 'latest'" | |
| npm publish --access public | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.THREE_NEBULA_NPM_PUBLISH_TOKEN}} |