Skip to content

Publish to NPM

Publish to NPM #4

Workflow file for this run

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'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- 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 nx publish $PACKAGE --ver=$VERSION --tag=latest
env:
BC_CLIENT_ID: ${{ secrets.BC_CLIENT_ID }}
BC_CLIENT_SECRET: ${{ secrets.BC_CLIENT_SECRET }}
BC_GRAPHQL_API: ${{ secrets.BC_GRAPHQL_API }}
BC_GRAPHQL_TOKEN: ${{ secrets.BC_GRAPHQL_TOKEN }}
BC_REST_API: ${{ secrets.BC_REST_API }}
JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
ORO_CLIENT_ID: ${{ secrets.ORO_CLIENT_ID }}
ORO_CLIENT_SECRET: ${{ secrets.ORO_CLIENT_SECRET }}
ORO_STORE_URL: ${{ secrets.ORO_STORE_URL }}
STORE_HASH: ${{ secrets.STORE_HASH }}
X_AUTH_TOKEN: ${{ secrets.X_AUTH_TOKEN }}
- name: Update the package version number
run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}