Skip to content

Version Packages

Version Packages #758

Workflow file for this run

name: Release
on:
push:
branches:
- master
pull_request:
types: [closed]
branches:
- master
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
# Job 1: Create/update Version PR (on push to master)
version:
if: github.event_name == 'push'
name: Create Version PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm i
- name: Create Release Pull Request
uses: changesets/action@v1
with:
title: "Version Packages"
commit: "Version Packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Job 2: Publish to npm (when Version PR is merged)
publish:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Version Packages')
name: Publish to npm
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Upgrade npm for OIDC support
run: npm install -g npm@latest
- name: Install Dependencies
run: npm i
- name: Build packages
run: npm run build
- name: Publish to npm
uses: changesets/action@v1
with:
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Clear tokens to allow OIDC authentication
# https://github.com/orgs/community/discussions/176761
# https://github.com/changesets/changesets/issues/1152
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""