-
Notifications
You must be signed in to change notification settings - Fork 4.1k
89 lines (77 loc) · 2.75 KB
/
release.yml
File metadata and controls
89 lines (77 loc) · 2.75 KB
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
name: Release
on:
push:
branches:
- main
- release-v*
paths:
- '.changeset/**'
- '.github/workflows/release.yml'
workflow_dispatch:
concurrency:
group: 'release'
cancel-in-progress: false
jobs:
release:
name: Release
runs-on: ubuntu-latest
# do not attempt running in forks
if: github.repository_owner == 'vercel'
steps:
- name: Create access token for GitHub App
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.VERCEL_AI_SDK_GITHUB_APP_CLIENT_ID }}
private-key: ${{ secrets.VERCEL_AI_SDK_GITHUB_APP_PRIVATE_KEY_PKCS8 }}
- name: Get GitHub App User ID
id: app-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Configure git user for GitHub App
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.app-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Checkout Repo
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Setup Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
- name: Install Dependencies
run: pnpm i
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci:version
publish: pnpm ci:release
setupGitUser: false
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
- name: Find release PR number
if: steps.changesets.outputs.published == 'true'
id: release-pr
run: echo "number=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls --jq '.[0].number')" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Notify released PRs and issues
if: steps.changesets.outputs.published == 'true'
run: |
cd .github/scripts/notify-released
npm install --no-save
node index.mjs
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
PULL_REQUEST_NUMBER: ${{ steps.release-pr.outputs.number }}