v0.2.1 #14
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: Publish | |
on: | |
release: | |
types: [created] | |
permissions: | |
# to clone the repo | |
contents: read | |
# to publish to GitHub package registry | |
packages: write | |
# for NPM provenance | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Set up | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: "https://registry.npmjs.org" | |
# Prepare for release | |
- name: Install dependencies | |
run: | | |
yarn install --immutable | |
- name: Build | |
run: | | |
yarn build | |
- name: Run tests | |
run: | | |
yarn test | |
- id: dist-tag | |
name: Define dist tag | |
run: | | |
if ${{ github.event.release.prerelease }}; then | |
DIST_TAG=next | |
else | |
DIST_TAG=latest | |
fi | |
echo "dist-tag=$DIST_TAG" >> $GITHUB_OUTPUT | |
# Release to NPM | |
- name: Publish package on NPM | |
run: cd out && npm publish --provenance --access public --tag ${{ steps.dist-tag.outputs.dist-tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Release to GitHub Packages | |
- name: Setup Node for GitHub Packages | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: "https://npm.pkg.github.com" | |
- name: Publish package on GitHub Packages | |
run: cd out && npm publish --access public --tag ${{ steps.dist-tag.outputs.dist-tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |