[ci] Add prerelease nightly and manual script for compiler
Publishes the compiler packages on the same schedule as the React ones. For now the manual script can only build from `main` but in the future we can add support for building specific commits ghstack-source-id: 66676c578b795b90bf3c5715be8900438868b6ee Pull Request resolved: https://github.com/facebook/react/pull/30615
Lauren Tan committed
Aug 6, 2024 at 14:41 UTC
47d85282bcd95f215ad4a496ae1f951904a9ffe4
4 files changed
+93
.github/workflows/compiler_prereleases.yml
new
+51
@@ -0,0 +1,51 @@
1
+name: (Compiler) Publish Prereleases
2
+
3
+on:
4
+ workflow_call:
5
+ inputs:
6
+ commit_sha:
7
+ required: true
8
+ default: ''
9
+ type: string
10
+ release_channel:
11
+ required: true
12
+ type: string
13
+ dist_tag:
14
+ required: true
15
+ type: string
16
+ secrets:
17
+ NPM_TOKEN:
18
+ required: true
19
+
20
+env:
21
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
22
+ # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
23
+ SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
24
+ GH_TOKEN: ${{ github.token }}
25
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
26
+
27
+defaults:
28
+ run:
29
+ working-directory: compiler
30
+
31
+jobs:
32
+ publish_prerelease:
33
+ name: Publish prelease (${{ inputs.release_channel }}) ${{ inputs.commit_sha }} @${{ inputs.dist_tag }}
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+ - uses: actions/setup-node@v4
38
+ with:
39
+ node-version-file: '.nvmrc'
40
+ cache: yarn
41
+ cache-dependency-path: compiler/yarn.lock
42
+ - name: Restore cached node_modules
43
+ uses: actions/cache@v4
44
+ id: node_modules
45
+ with:
46
+ path: "**/node_modules"
47
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }}
48
+ - run: yarn install --frozen-lockfile
49
+ - run: |
50
+ cp ./scripts/release/ci-npmrc ~/.npmrc
51
+ scripts/release/publish.js --ci --tags ${{ inputs.dist_tag }}
.github/workflows/compiler_prereleases_manual.yml
new
+21
@@ -0,0 +1,21 @@
1
+name: (Compiler) Publish Prereleases Manual
2
+
3
+on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ prerelease_commit_sha:
7
+ required: false
8
+
9
+env:
10
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
11
+
12
+jobs:
13
+ publish_prerelease_experimental:
14
+ name: Publish to Experimental channel
15
+ uses: facebook/react/.github/workflows/compiler_prereleases.yml@main
16
+ with:
17
+ commit_sha: ${{ inputs.prerelease_commit_sha || github.sha }}
18
+ release_channel: experimental
19
+ dist_tag: experimental
20
+ secrets:
21
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
.github/workflows/compiler_prereleases_nightly.yml
new
+20
@@ -0,0 +1,20 @@
1
+name: (Compiler) Publish Prereleases Nightly
2
+
3
+on:
4
+ schedule:
5
+ # At 10 minutes past 16:00 on Mon, Tue, Wed, Thu, and Fri
6
+ - cron: 10 16 * * 1,2,3,4,5
7
+
8
+env:
9
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
10
+
11
+jobs:
12
+ publish_prerelease_experimental:
13
+ name: Publish to Experimental channel
14
+ uses: facebook/react/.github/workflows/compiler_prereleases.yml@main
15
+ with:
16
+ commit_sha: ${{ github.sha }}
17
+ release_channel: experimental
18
+ dist_tag: experimental
19
+ secrets:
20
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
compiler/scripts/release/ci-npmrc
new
+1
@@ -0,0 +1 @@
1
+//registry.npmjs.org/:_authToken=${NPM_TOKEN}