v16.1.2 #13
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: NPM Publish | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-yarn-dependencies | |
with: | |
path: .yarn/cache | |
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 | |
run: yarn --immutable | |
- name: build | |
run: yarn build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
publish-npm: | |
needs: build | |
environment: production | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: ./dist | |
- name: Set new version | |
run: npm version --no-git-tag-version ${{ env.RELEASE_VERSION }} | |
- run: npm publish --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} |