chore: prepare 1.0.0 trusted npm release #50
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 @angular-bootstrap/ngbootstrap | |
| on: | |
| release: | |
| types: | |
| - published | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| environment: npm-production | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| registry-url: https://registry.npmjs.org | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Run tests | |
| run: pnpm test:ci | |
| - name: Build library | |
| run: pnpm build | |
| - name: Validate package metadata | |
| run: pnpm release:verify | |
| - name: Validate release tag | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(node -p "require('./package.json').version")" | |
| TAG="${GITHUB_REF_NAME}" | |
| if [ "$TAG" != "v$VERSION" ]; then | |
| echo "Release tag $TAG must match package version v$VERSION." | |
| exit 1 | |
| fi | |
| - name: Verify version is unpublished | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(node -p "require('./package.json').version")" | |
| if npm view "@angular-bootstrap/ngbootstrap@$VERSION" version >/dev/null 2>&1; then | |
| echo "@angular-bootstrap/ngbootstrap@$VERSION is already published." | |
| exit 1 | |
| fi | |
| - name: Inspect npm package contents | |
| run: pnpm pack:dry-run | |
| - name: Audit production dependencies | |
| run: pnpm security:audit | |
| - name: Publish to npm | |
| run: npm publish ./dist/ngbootstrap --access public --provenance |