Release 1.8.18 #46
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 npm Package | |
| on: | |
| push: | |
| tags: | |
| - "*.*.*" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| if: ${{ !startsWith(github.ref_name, 'plugin-') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Verify tag matches package version | |
| shell: bash | |
| run: | | |
| PACKAGE_VERSION="$(node -p "require('./package.json').version")" | |
| if [ "${PACKAGE_VERSION}" != "${GITHUB_REF_NAME}" ]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package.json version ${PACKAGE_VERSION}" | |
| exit 1 | |
| fi | |
| - name: Smoke test release package | |
| run: npm run release:smoke | |
| - name: Verify package contents | |
| run: npm run release:check | |
| - name: Check whether version already exists on npm | |
| id: npm_version | |
| shell: bash | |
| run: | | |
| PACKAGE_NAME="$(node -p "require('./package.json').name")" | |
| PACKAGE_VERSION="$(node -p "require('./package.json').version")" | |
| if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version >/dev/null 2>&1; then | |
| echo "published=true" >> "$GITHUB_OUTPUT" | |
| echo "Version ${PACKAGE_VERSION} is already published. Skipping npm publish." | |
| else | |
| echo "published=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish package to npm | |
| if: steps.npm_version.outputs.published != 'true' | |
| run: npm publish --access public |