v1.9.1 #7
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: Release | |
| on: | |
| # This job runs when a new release is published | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC | |
| jobs: | |
| prePublishPackageTest: | |
| name: Prepublish package test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Restore npm cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.npm | |
| key: npm-no-lock-v1-${{ runner.os }}-node24-${{ hashFiles('package.json') }} | |
| restore-keys: | | |
| npm-no-lock-v1-${{ runner.os }}-node24- | |
| - name: Install Node.js and npm | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| package-manager-cache: false | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: npm install --package-lock=false | |
| # Store the name of the release | |
| # See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions | |
| - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - run: npm version $RELEASE_VERSION --no-git-tag-version | |
| - name: Unit tests | |
| run: npm test | |
| - name: Verify package contents | |
| run: npm pack --dry-run | |
| - name: Build publish tarball | |
| run: echo "PACKAGE_TGZ=$(npm pack --silent)" >> $GITHUB_ENV | |
| - name: Packed install smoke test | |
| run: node ./scripts/ci/pack-smoke.js | |
| env: | |
| PACKAGE_TGZ: ${{ env.PACKAGE_TGZ }} | |
| - name: Upload tested tarball | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: npm-package | |
| path: ${{ env.PACKAGE_TGZ }} | |
| if-no-files-found: error | |
| npmPublish: | |
| name: Publish to NPM | |
| needs: prePublishPackageTest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download tested tarball | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: npm-package | |
| - name: Install Node.js and npm | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| package-manager-cache: false | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish new version | |
| run: npm publish ./*.tgz --access public --tag=latest |