Skip to content

Release

Release #241

Workflow file for this run

name: Release
on:
workflow_dispatch:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
concurrency:
group: ${{ github.ref }}-release
permissions:
actions: read
jobs:
release:
# Only run this if it's a workflow_dispatch trigger or the CI workflow was successful
if: ${{ github.event.workflow_run == null || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
# This environment contains secrets needed for publishing and is only accessible to main builds
environment: release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Don't save creds in the git config (so it's easier to override later)
persist-credentials: false
- name: Set up Node
uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: .nvmrc
- run: yarn --frozen-lockfile
- name: Check if release is needed
uses: ecraig12345/beachball-actions/should-release@v2
id: shouldRelease
with:
token: ${{ secrets.GITHUB_TOKEN }}
batch: true
mode: output
changeGlob: '.changeset/*.md'
- name: Release
if: ${{ steps.shouldRelease.outputs.shouldRelease == 'yes' }}
uses: actions/github-script@v7
env:
# Used by changesets and when pushing updates
GITHUB_TOKEN: ${{ secrets.REPO_PAT }}
with:
# Used to authenticate the `github` object (used for creating the release)
github-token: ${{ secrets.REPO_PAT }}
script: |
const release = require('./scripts/release/index.cjs');
await release(github);