Publish to NPM #241
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
name: Publish to NPM | |
on: | |
release: | |
tags: | |
- "**-[0-9]+.[0-9]+.[0-9]+" | |
- "**-[0-9]+.[0-9]+.[0-9]+-*" | |
types: [published] | |
jobs: | |
build-and-publish: | |
name: 🚀 Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.target_commitish }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "yarn" | |
registry-url: https://registry.npmjs.org/ | |
- name: Install | |
run: yarn install | |
- name: Preparing environment for release | |
run: | | |
VERSION=$(echo $GITHUB_REF_NAME | sed 's/^.*[A-Za-z]-//g') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "PACKAGE=$(echo $GITHUB_REF_NAME | sed "s/-${VERSION}//g")" >> $GITHUB_ENV | |
- name: Release | |
run: | | |
git config --global user.name "Automated NPM Release" | |
git config --global user.email "[email protected]" | |
echo "Publishing $PACKAGE @ $VERSION" | |
yarn config set registry https://registry.npmjs.org/ | |
yarn nx publish $PACKAGE --ver=$VERSION --tag=latest --verbose | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |