Manage Changesets #1053
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: Manage Changesets | |
on: | |
workflow_run: | |
workflows: [CI] | |
branches: [main] | |
types: [completed] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
changesets-version: | |
name: Manage Changesets Pull Request | |
runs-on: ubuntu-latest | |
# only run if CI is successful | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- 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 | |
- uses: ./.github/actions/setup-node-env | |
- run: make build | |
# down to business... | |
- name: Use GitHub App Token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.GU_CHANGESETS_APP_ID }} | |
private-key: ${{ secrets.GU_CHANGESETS_PRIVATE_KEY }} | |
- name: Set git user to Gu Changesets app | |
run: | | |
git config user.name "gu-changesets-release-pr[bot]" | |
git config user.email "gu-changesets-release-pr[bot]@users.noreply.github.com" | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm changeset publish | |
title: '🦋 Release package updates' | |
commit: 'Bump package versions' | |
setupGitUser: false | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |