Update github action #5
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: Test, Build and Publish to GitHub Packages | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
test-build-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Cache Yarn dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.yarn/cache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run tests | |
run: yarn test | |
- name: Build the project | |
run: yarn build | |
# Save the build output as an artifact (updated to v3) | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-output | |
path: ./dist # Path to the directory containing the build output | |
- name: Publish to GitHub Packages | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
yarn publish --new-version $VERSION --registry https://npm.pkg.github.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |