Skip to content

Add notes for future #85

Add notes for future

Add notes for future #85

Workflow file for this run

name: Test, Build, Publish
on:
# Workflow dispatch only works when version has not been published yet
workflow_dispatch:
push:
branches: ["main"]
tags:
# Publish npm package when a new tag is pushed
- "*.*.*"
# Allow one concurrent deployment
concurrency:
group: "workflow"
cancel-in-progress: true
permissions:
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
outputs:
IS_RELEASE: ${{ steps.check-tag.outputs.IS_RELEASE }}
PACKAGE: ${{ steps.pack.outputs.PACKAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
- run: pnpm install
- name: Test and ensure dependencies were built as expected
run: pnpm test
- name: Create type definitions
run: pnpm create-definitions
- name: Check if tag is release tag
id: check-tag
run: |
echo ${{ github.event.ref }}
if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
fi
- name: Bump version
if: ${{ steps.check-tag.outputs.IS_RELEASE == 'true' }}
# Bump ephemeral version based on git tag which we previously confirmed to be set
run: npm --no-git-tag-version version from-git
- name: Setup .npmrc file to publish to npm
if: ${{ steps.check-tag.outputs.IS_RELEASE == 'true' }}
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Publish artifacts to npm
if: ${{ steps.check-tag.outputs.IS_RELEASE == 'true' }}
# Need to add --access public to publish scoped package
# Disable git check as the version was bumped
run: pnpm publish --no-git-checks --provenance --access public