Skip to content
name: Test, Build and Publish to GitHub Packages
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
# Authenticate with GitHub Packages
- name: Authenticate with GitHub Packages
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Install dependencies
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
# Build the package
- name: Build the package
run: yarn build
# Publish the package to GitHub Packages
- name: Publish to GitHub Packages
run: yarn publish --access public --verbose # Or use 'restricted' for private packages