Skip to content

Commit

Permalink
refactor(ci): to use github app auth over long-lived credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeekens committed Sep 25, 2023
1 parent abd995d commit 24f02f5
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ jobs:
runs-on: ubuntu-latest

steps:
# Get GitHub token via the CT Changesets App
- name: Generate GitHub token (via CT Changesets App)
id: generate_github_token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.CT_CHANGESETS_APP_ID }}
private_key: ${{ secrets.CT_CHANGESETS_APP_PEM }}

- name: Checkout
uses: actions/checkout@v3
with:
# Pass a personal access token (using our `ct-release-bot` account) to be able to trigger
# other workflows
# Pass a personal access token (using our `ct-changesets` app) to be able to trigger other workflows
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
token: ${{ steps.generate_github_token.outputs.token }}

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
Expand Down Expand Up @@ -53,7 +60,7 @@ jobs:
publish: pnpm changeset publish
version: pnpm changeset:version-and-format
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}

# Publish canary releases only if the packages weren't published already
- name: Publishing canary releases to npm registry
Expand All @@ -63,4 +70,4 @@ jobs:
pnpm changeset version --snapshot canary
pnpm changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}

0 comments on commit 24f02f5

Please sign in to comment.