NPM Package Publish - Stable #2
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: NPM Package Publish - Stable | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Cache node modules | |
id: cache-yarn | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-module | |
with: | |
path: | | |
~/.cache/yarn | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: NO_YARN_POSTINSTALL=1 yarn install --frozen-lockfile | |
- name: Yarn Build | |
run: yarn build | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- run: yarn test | |
publish-gpr: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- run: yarn publish-stable | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_ACCESS_TOKEN}} |