Skip to content

Release

Release #5630

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
type: choice
description: 'Release Version'
required: true
default: 'next'
options:
- latest
- next
branch:
description: 'Release Branch (confirm release branch)'
required: true
default: 'main'
permissions:
id-token: write
jobs:
release:
name: Release
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
runs-on: ubuntu-latest
environment: npm
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 25
ref: ${{ github.event.inputs.branch }}
- name: Cache Tool Downloads
uses: actions/cache@v5
with:
path: ~/.cache
key: ${{ runner.os }}-toolcache-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-toolcache-
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
# Update npm to the latest version to enable OIDC
- name: Update npm
run: |
npm install -g npm@latest
npm --version
- name: Install deps
run: pnpm install --frozen-lockfile
- name: Restore Turborepo cache
uses: actions/cache/restore@v5
with:
path: .turbo/cache
key: ${{ runner.os }}-turbo-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-turbo-${{ github.ref_name }}-
${{ runner.os }}-turbo-
- name: Generate preview version
if: github.event.inputs.version == 'next'
run: |
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9-]/-/g' | tr '[:upper:]' '[:lower:]')
npx changeset version --snapshot "$SAFE_BRANCH"
- name: Build and test Packages
run: |
git fetch origin main
pnpm run build:packages
ls -l packages/*/dist packages/*/package.json
- name: Publish latest version
if: github.event.inputs.version == 'latest'
run: |
pnpm -r publish --tag ${{ github.event.inputs.version }} --publish-branch ${{ github.event.inputs.branch }}
- name: Publish preview version
if: github.event.inputs.version == 'next'
run: |
pnpm -r publish --tag next --no-git-checks