Publish packages to NPM (#10108) #119
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
name: Publish packages to NPM | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'packages/*/package.json' | |
env: | |
NODE_VERSION: 14.21.3 | |
permissions: | |
contents: read | |
jobs: | |
publish: | |
permissions: | |
contents: none | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: '${{ secrets.SPINNAKERBOT_PERSONAL_ACCESS_TOKEN }}' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: git - tag bumped packages | |
id: tag | |
run: | | |
git config user.name spinnakerbot | |
git config user.email spinnakerbot@spinnaker.io | |
scripts/gha_tag_bumped_packages.sh | |
- name: yarn | |
if: ${{ steps.tag.outputs.tagged == 'true' }} | |
run: yarn --frozen-lockfile | |
- name: build all packages | |
if: ${{ steps.tag.outputs.tagged == 'true' }} | |
run: npx lerna run build | |
env: | |
NODE_ENV: production | |
- name: publish packages to npm | |
if: ${{ steps.tag.outputs.tagged == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN | |
# Publish all changed packages, but do not build a second time | |
npx lerna publish from-git --yes --ignore-scripts | |
env: | |
CI: true | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |