Release Subpackages #406
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: Release Subpackages | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- .changeset/** | |
- .github/workflows/release-subpackages.yml | |
workflow_run: | |
workflows: ["Node CI for app development"] | |
types: | |
- completed | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release-subpackages-snapshot: | |
if: "!startsWith(github.head_ref, 'changeset-release/')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: | | |
pnpm add turbo --global | |
pnpm install --frozen-lockfile | |
- name: Setup .npmrc | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
EOF | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Retrieve changesets information | |
id: changesets-status | |
run: | | |
pnpm changeset status --output status.json | |
echo "CHANGESETS_LENGTH=$(jq -r '.changesets | length' status.json)" >> $GITHUB_OUTPUT | |
rm status.json | |
- name: Snapshot release to npm | |
if: steps.changesets-status.outputs.CHANGESETS_LENGTH > 0 | |
run: | | |
pnpm run release-subpackages:snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
release-subpackages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: | | |
pnpm add turbo --global | |
pnpm install --frozen-lockfile | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: Release Subpackages | |
version: pnpm run version-subpackages | |
publish: pnpm run release-subpackages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |