[ci] Add prerelease workflows to GH actions
Migrates the last 2 remaining circleci jobs to GH actions. The behavior of these workflows have been kept the same. Overview: - Reusable workflow `runtime_prereleases.yml` added - Nightly workflow on cron triggers the reusable workflow with the current HEAD sha - Manual workflow which can be triggered from the github UI with a `prerelease_commit_sha` which triggers the reusable workflow ghstack-source-id: 84ef33c73248594fa5c1523190697c7192dbc615 Pull Request resolved: https://github.com/facebook/react/pull/30495
Lauren Tan committed
Jul 29, 2024 at 11:26 UTC
9af9764f5571c0bfd8447b66ce7bfc419356160b
3 files changed
+127
.github/workflows/runtime_prereleases.yml
new
+49
@@ -0,0 +1,49 @@
1
+name: (Runtime) Publish Prereleases
2
+
3
+on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ commit_sha:
7
+ required: true
8
+ default: ''
9
+ type: string
10
+ release_channel:
11
+ required: true
12
+ type: choice
13
+ options:
14
+ - stable
15
+ - experimental
16
+ dist_tag:
17
+ required: true
18
+ type: string
19
+
20
+env:
21
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
22
+
23
+jobs:
24
+ publish_prerelease:
25
+ name: Publish prelease (${{ inputs.release_channel }}) ${{ inputs.commit_sha }} @${{ inputs.dist_tag }}
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-node@v4
30
+ with:
31
+ node-version: 18.20.1
32
+ cache: yarn
33
+ cache-dependency-path: yarn.lock
34
+ - name: Restore cached node_modules
35
+ uses: actions/cache@v4
36
+ id: node_modules
37
+ with:
38
+ path: "**/node_modules"
39
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
40
+ - run: yarn install --frozen-lockfile
41
+ - run: yarn install --frozen-lockfile
42
+ working-directory: scripts/release
43
+ - run: |
44
+ scripts/release/prepare-release-from-ci.js --skipTests -r ${{ inputs.release_channel }} --commit=${{ inputs.commit_sha }}
45
+ cp ./scripts/release/ci-npmrc ~/.npmrc
46
+ scripts/release/publish.js --ci --tags ${{ inputs.dist_tag }}
47
+ env:
48
+ GH_TOKEN: ${{ github.token }}
49
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
.github/workflows/runtime_prereleases_manual.yml
new
+43
@@ -0,0 +1,43 @@
1
+name: (Runtime) Publish Prereleases Manual
2
+
3
+on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ prerelease_commit_sha:
7
+ required: true
8
+
9
+env:
10
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
11
+
12
+jobs:
13
+
14
+ publish_prerelease_canary:
15
+ name: Publish to Canary channel
16
+ uses: facebook/react/.github/workflows/runtime_prereleases.yml@main
17
+ with:
18
+ commit_sha: ${{ inputs.prerelease_commit_sha }}
19
+ release_channel: stable
20
+ # The tags to use when publishing canaries. The main one we should
21
+ # always include is "canary" but we can use multiple (e.g. alpha,
22
+ # beta, rc). To declare multiple, use a comma-separated string, like
23
+ # this:
24
+ # dist_tag: "canary,alpha,beta,rc"
25
+ #
26
+ # TODO: We currently tag canaries with "next" in addition to "canary"
27
+ # because this used to be called the "next" channel and some
28
+ # downstream consumers might still expect that tag. We can remove this
29
+ # after some time has elapsed and the change has been communicated.
30
+ dist_tag: canary,next,rc
31
+
32
+ publish_prerelease_experimental:
33
+ name: Publish to Experimental channel
34
+ uses: facebook/react/.github/workflows/runtime_prereleases.yml@main
35
+ # NOTE: Intentionally running these jobs sequentially because npm
36
+ # will sometimes fail if you try to concurrently publish two
37
+ # different versions of the same package, even if they use different
38
+ # dist tags.
39
+ needs: publish_prerelease_canary
40
+ with:
41
+ commit_sha: ${{ inputs.prerelease_commit_sha }}
42
+ release_channel: experimental
43
+ dist_tag: experimental
.github/workflows/runtime_prereleases_nightly.yml
new
+35
@@ -0,0 +1,35 @@
1
+name: (Runtime) 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
+ workflow_dispatch:
8
+ inputs:
9
+ prerelease_commit_sha:
10
+ required: false
11
+
12
+env:
13
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
14
+
15
+jobs:
16
+ publish_prerelease_canary:
17
+ name: Publish to Canary channel
18
+ uses: facebook/react/.github/workflows/runtime_prereleases.yml@main
19
+ with:
20
+ commit_sha: ${{ github.sha }}
21
+ release_channel: stable
22
+ dist_tag: canary,next,rc
23
+
24
+ publish_prerelease_experimental:
25
+ name: Publish to Experimental channel
26
+ uses: facebook/react/.github/workflows/runtime_prereleases.yml@main
27
+ # NOTE: Intentionally running these jobs sequentially because npm
28
+ # will sometimes fail if you try to concurrently publish two
29
+ # different versions of the same package, even if they use different
30
+ # dist tags.
31
+ needs: publish_prerelease_canary
32
+ with:
33
+ commit_sha: ${{ github.sha }}
34
+ release_channel: experimental
35
+ dist_tag: experimental