-
Notifications
You must be signed in to change notification settings - Fork 280
142 lines (124 loc) · 4.75 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Release
run-name: Release
on:
push:
branches:
- main
- release/v4
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
name: Release
if: ${{ github.repository == 'clerk/javascript' }}
runs-on: ${{ vars.RUNNER_NORMAL || 'ubuntu-latest' }}
timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }}
permissions:
contents: write
id-token: write
packages: write
pull-requests: write
issues: read
statuses: write
checks: write
steps:
- name: Echo github context
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- name: Setup
id: config
uses: ./.github/actions/init
with:
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
turbo-team: ${{ vars.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
playwright-enabled: true # Must be present to enable caching on branched workflows
- name: Build release
run: pnpm turbo build $TURBO_ARGS --force
- name: Create Release PR
id: changesets
uses: changesets/action@v1
with:
commit: 'ci(repo): Version packages'
title: 'ci(repo): Version packages'
publish: pnpm release
# Workaround for https://github.com/changesets/changesets/issues/421
version: pnpm version-packages
env:
GITHUB_TOKEN: ${{ secrets.CLERK_COOKIE_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
- name: Trigger workflows on related repos
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v7
with:
result-encoding: string
retries: 3
retry-exempt-status-codes: 400,401
github-token: ${{ secrets.CLERK_COOKIE_PAT }}
script: |
const preMode = require("fs").existsSync("./.changeset/pre.json");
if (!preMode) {
const clerkjsVersion = require('./packages/clerk-js/package.json').version;
const nextjsVersion = require('./packages/nextjs/package.json').version;
github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'cloudflare-workers',
workflow_id: 'prepare-prod-clerkjs-proxy-pr.yml',
ref: 'main',
inputs: { version: clerkjsVersion }
})
github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'dashboard',
workflow_id: 'prepare-nextjs-sdk-update.yml',
ref: 'main',
inputs: { version: nextjsVersion }
})
} else{
core.warning("Changeset in pre-mode should not prepare a ClerkJS production release")
}
- 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
# We're running the CI workflow (where node v20 modules are cached) in
# merge_group and not on main, we need to explicitly cache node_modules here so
# that follow-on branches can use the cached version of node_modules rather
# than recreating them every time.
cache-for-alternate-node-versions:
name: Cache for Alternate Node Versions
runs-on: ${{ vars.RUNNER_NORMAL || 'ubuntu-latest' }}
timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }}
continue-on-error: true
strategy:
matrix:
version: [22] # NOTE: 18 is cached in the main release workflow
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
show-progress: false
- name: Cache node_modules (Node v${{ matrix.version }})
uses: ./.github/actions/init
with:
node-version: ${{ matrix.version }}
turbo-team: ''
turbo-token: ''