Production release PR #266
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: Production release PR | |
run-name: Production release PR | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release: | |
name: Release | |
if: ${{ github.repository == 'clerkinc/javascript' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Echo github context | |
run: echo "$GITHUB_CONTEXT" | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Create Release PR | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: Version Packages | |
commit: "chore(repo): Version packages" | |
publish: npm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.CLERK_COOKIE_PAT }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Trigger workflows on related repos | |
if: steps.changesets.outputs.published == 'true' | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
retries: 3 | |
retry-exempt-status-codes: 400,401 | |
github-token: ${{ secrets.CLERK_COOKIE_PAT }} | |
script: | | |
const clerkjsVersion = require('./packages/clerk-js/package.json').version; | |
github.rest.actions.createWorkflowDispatch({ | |
owner: 'clerkinc', | |
repo: 'cloudflare-workers', | |
workflow_id: 'release-prod-clerkjs-proxy.yml', | |
ref: 'main', | |
inputs: { version: clerkjsVersion } | |
}) | |
- name: Generate notification payload | |
id: notification | |
if: steps.changesets.outputs.published == 'true' | |
run: payload=$(node scripts/notify.mjs '${{ steps.changesets.outputs.publishedPackages }}' '${{ github.actor }}') && echo ::set-output name=payload::${payload//$'\n'/'%0A'} | |
- name: Send commit log to Slack | |
id: slack | |
if: steps.changesets.outputs.published == 'true' | |
uses: slackapi/[email protected] | |
with: | |
payload: ${{ steps.notification.outputs.payload }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHANGELOG_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |