Publish to NPM #27
Workflow file for this run
This file contains 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
# Workflow to publish a new release to NPM | |
# | |
name: Publish to NPM | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write # Needed for provenance data generation | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
# Build all packages | |
- name: Build | |
run: npx nx run-many --target=build --all | |
# Configure Git for automated commits | |
- name: Configuring Git | |
run: git config --global user.name "GitHub CD bot" && git config --global user.email "github-cd-bot@users.noreply.github.com" | |
# Bump packages versions | |
- name: Bump packages versions | |
run: npx nx release --first-release --skip-publish ${{ github.event.release.tag_name }} | |
# Publish packages to NPM | |
- name: Publish package to NPM | |
run: npx nx release publish ${{ github.event.release.tag_name }} --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_CONFIG_PROVENANCE: false | |
# Fix the package-lock.json file | |
- name: Fix package-lock.json | |
run: npm install | |
# Push changes to GitHub (updated package.json,...) | |
- name: Push changes to GitHub | |
run: git push origin HEAD:main |