Skip to content

Commit

Permalink
[ci] Add prerelease nightly and manual script for compiler
Browse files Browse the repository at this point in the history
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: #30615
  • Loading branch information
poteto committed Aug 6, 2024
1 parent c9143b9 commit 47d8528
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/compiler_prereleases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: (Compiler) Publish Prereleases

on:
workflow_call:
inputs:
commit_sha:
required: true
default: ''
type: string
release_channel:
required: true
type: string
dist_tag:
required: true
type: string
secrets:
NPM_TOKEN:
required: true

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

defaults:
run:
working-directory: compiler

jobs:
publish_prerelease:
name: Publish prelease (${{ inputs.release_channel }}) ${{ inputs.commit_sha }} @${{ inputs.dist_tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache-dependency-path: compiler/yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
id: node_modules
with:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: |
cp ./scripts/release/ci-npmrc ~/.npmrc
scripts/release/publish.js --ci --tags ${{ inputs.dist_tag }}
21 changes: 21 additions & 0 deletions .github/workflows/compiler_prereleases_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: (Compiler) Publish Prereleases Manual

on:
workflow_dispatch:
inputs:
prerelease_commit_sha:
required: false

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles

jobs:
publish_prerelease_experimental:
name: Publish to Experimental channel
uses: facebook/react/.github/workflows/compiler_prereleases.yml@main
with:
commit_sha: ${{ inputs.prerelease_commit_sha || github.sha }}
release_channel: experimental
dist_tag: experimental
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/compiler_prereleases_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: (Compiler) Publish Prereleases Nightly

on:
schedule:
# At 10 minutes past 16:00 on Mon, Tue, Wed, Thu, and Fri
- cron: 10 16 * * 1,2,3,4,5

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles

jobs:
publish_prerelease_experimental:
name: Publish to Experimental channel
uses: facebook/react/.github/workflows/compiler_prereleases.yml@main
with:
commit_sha: ${{ github.sha }}
release_channel: experimental
dist_tag: experimental
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions compiler/scripts/release/ci-npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

0 comments on commit 47d8528

Please sign in to comment.