Skip to content

Commit 6ff3684

Browse files
committed
[release] add new ci to use changesets/action for stable release
1 parent c570fc6 commit 6ff3684

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Trigger Release (New)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseType:
7+
description: Release Type
8+
required: true
9+
type: choice
10+
options:
11+
# - canary
12+
- stable
13+
# - release-candidate
14+
15+
force:
16+
description: Forced Release
17+
default: false
18+
type: boolean
19+
20+
env:
21+
NAPI_CLI_VERSION: 2.14.7
22+
TURBO_VERSION: 2.3.3
23+
NODE_LTS_VERSION: 20
24+
25+
jobs:
26+
start:
27+
if: github.repository_owner == 'vercel'
28+
runs-on: ubuntu-latest
29+
env:
30+
NEXT_TELEMETRY_DISABLED: 1
31+
# we build a dev binary for use in CI so skip downloading
32+
# canary next-swc binaries in the monorepo
33+
NEXT_SKIP_NATIVE_POSTINSTALL: 1
34+
35+
environment: release-${{ github.event.inputs.releaseType || 'canary' }}
36+
steps:
37+
- name: Setup node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: ${{ env.NODE_LTS_VERSION }}
41+
check-latest: true
42+
43+
# Since actions/checkout won't include the latest tag information,
44+
# use the old clone workflow while still preserving branch specific
45+
# checkout behavior to support backports.
46+
# x-ref: https://github.com/vercel/next.js/pull/63167
47+
- name: Clone Next.js repository
48+
run: git clone https://github.com/vercel/next.js.git --depth=25 --single-branch --branch ${GITHUB_REF_NAME:-canary} .
49+
50+
- name: Check token
51+
run: gh auth status
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
54+
55+
- name: Get commit of the latest tag
56+
run: echo "LATEST_TAG_COMMIT=$(git rev-list -n 1 $(git describe --tags --abbrev=0))" >> $GITHUB_ENV
57+
58+
- name: Get latest commit
59+
run: echo "LATEST_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
60+
61+
- name: Check if new commits since last tag
62+
if: ${{ github.event.inputs.releaseType != 'stable' && github.event.inputs.force != true }}
63+
run: |
64+
if [ "$LATEST_TAG_COMMIT" = "$LATEST_COMMIT" ]; then
65+
echo "No new commits. Exiting..."
66+
exit 1
67+
fi
68+
69+
# https://github.com/actions/virtual-environments/issues/1187
70+
- name: tune linux network
71+
run: sudo ethtool -K eth0 tx off rx off
72+
73+
- name: Setup corepack
74+
run: |
75+
76+
corepack enable
77+
pnpm --version
78+
79+
- id: get-store-path
80+
run: echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT
81+
82+
- uses: actions/cache@v4
83+
timeout-minutes: 5
84+
id: cache-pnpm-store
85+
with:
86+
path: ${{ steps.get-store-path.outputs.STORE_PATH }}
87+
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
88+
restore-keys: |
89+
pnpm-store-
90+
pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
91+
92+
- run: pnpm install
93+
94+
- run: pnpm run build
95+
96+
- name: Create Release Pull Request or Publish to NPM
97+
id: changesets
98+
uses: changesets/action@v1
99+
with:
100+
version: pnpm ci:version
101+
publish: pnpm ci:publish
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
104+
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"lerna": "lerna",
1414
"dev": "turbo run dev --parallel",
1515
"pack-next": "tsx scripts/pack-next.ts",
16+
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
17+
"ci:publish": "changeset publish",
1618
"test-types": "tsc",
1719
"test-unit": "jest test/unit/ packages/next/ packages/font",
1820
"test-dev": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",

0 commit comments

Comments
 (0)