-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14fdde0
commit 8a9cb74
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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' | ||
|
||
- 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: | | ||
npm ci | ||
git config --global user.name "Automated NPM Release" | ||
git config --global user.email "[email protected]" | ||
echo "Publishing $PACKAGE @ $VERSION" | ||
yarn nx publish $PACKAGE --ver=$VERSION --tag=latest | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Update the package version number | ||
run: git push | ||
env: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |