0.11.0 #2
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: npm publish | |
| on: | |
| push: | |
| tags: | |
| - 'v0.[0-9]+.[0-9]+-SNAPSHOT.[0-9]+' | |
| - 'v0.[0-9]+.[0-9]+' | |
| permissions: {} | |
| jobs: | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for OIDC (see https://docs.npmjs.com/trusted-publishers) | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - run: npm ci | |
| - name: Select dist-tag | |
| run: | | |
| GIT_TAG=${GITHUB_REF#refs/tags/*} | |
| if [[ "$GIT_TAG" == v0.+([0-9]).+([0-9])-SNAPSHOT.+([0-9]) ]]; then | |
| DIST_TAG=next | |
| elif [[ "$GIT_TAG" == v0.+([0-9]).+([0-9]) ]]; then | |
| DIST_TAG=latest | |
| else | |
| echo "Error: the tag name '$GIT_TAG' does not match any of the patterns" | |
| exit 1 | |
| fi | |
| echo "DIST_TAG=$DIST_TAG" >> "$GITHUB_ENV" | |
| - name: Check that KaitaiStream.js will be included | |
| run: | | |
| npm publish --tag "$DIST_TAG" --dry-run --json | jq --exit-status '.files | map(.path) | any(. == "KaitaiStream.js")' | |
| - name: Publish to npm | |
| run: npm publish --tag "$DIST_TAG" |