-
Notifications
You must be signed in to change notification settings - Fork 25k
Distribute React Native DevTools binaries via GitHub Releases #52930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b5cb475
72ef1f0
e090b2a
afe025d
3d13133
dc05171
359411e
5429325
1c2fbb8
843f561
5b02181
df892eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,9 +21,24 @@ jobs: | |||||
| git config --local user.name "React Native Bot" | ||||||
| - name: Create draft release | ||||||
| uses: actions/github-script@v6 | ||||||
| id: create-draft-release | ||||||
| with: | ||||||
| script: | | ||||||
| const {createDraftRelease} = require('./.github/workflow-scripts/createDraftRelease.js'); | ||||||
| const version = '${{ github.ref_name }}'; | ||||||
| const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js'); | ||||||
| await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}'); | ||||||
| return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}')).id; | ||||||
| result-encoding: string | ||||||
| - name: Upload release assets for DotSlash | ||||||
| uses: actions/github-script@v6 | ||||||
| env: | ||||||
| RELEASE_ID: ${{ steps.create-draft-release.outputs.result }} | ||||||
| with: | ||||||
| script: | | ||||||
| const {uploadReleaseAssetsForDotSlashFiles} = require('./scripts/releases/upload-release-assets-for-dotslash.js'); | ||||||
| const version = '${{ github.ref_name }}'; | ||||||
| await uploadReleaseAssetsForDotSlashFiles({ | ||||||
| version, | ||||||
| token: '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', | ||||||
| releaseId: process.env.RELEASE_ID, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }); | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Validate DotSlash Artifacts | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| release: | ||
| types: [published] | ||
| push: | ||
| branches: | ||
| - main | ||
|
Comment on lines
+7
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels wrong, are you sure about it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It turns out it's correct. Still I'm not 100% sure why we would need to run a continous validation of the dotslash artifacts. Specifically, this is a job that will run on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running on PRs targeting main is reasonable - it's just largely unnecessary, because we're only going to be touching the DotSlash files in bot commits that will be auto-landed in fbsource and then exported to the main branch. To reduce the false positive rate, we could narrow this down further to commits that actually touch the DotSlash file(s), though of course that could miss infra changes in the repo that might break the workflow. The scenario I'm trying to prevent is one where our internal binary publishing pipeline / CDN gets broken and stops being accessible from OSS, but we only find out extremely late, when we try to create a release commit. (As explained in the summary, we can't run the validation continuously in the branch because it would fail - by design - between pushing the release commit and publishing the release).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Let's let it run only on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's not feasible, unless we're OK with letting the job fail on release commits (and in fact tagging the release on a commit that has red CI signals!)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmm, what about on nightlies instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh interesting. I don't know that we want to block nightlies on this - doesn't look like we do so when another kind of test is broken - but I'm definitely open to making this a scheduled job for periodic validation, plus running on pushes+PRs that touch the actual DotSlash file and related infra. WDYT?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 5b02181. |
||
| paths: | ||
| - packages/debugger-shell/bin/react-native-devtools | ||
| - "scripts/releases/**" | ||
| - package.json | ||
| - yarn.lock | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - packages/debugger-shell/bin/react-native-devtools | ||
| - "scripts/releases/**" | ||
| - package.json | ||
| - yarn.lock | ||
| # Same time as the nightly build: 2:15 AM UTC | ||
| schedule: | ||
| - cron: "15 2 * * *" | ||
|
|
||
| jobs: | ||
| validate-dotslash-artifacts: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
| - name: Install dependencies | ||
| uses: ./.github/actions/yarn-install | ||
| - name: Configure Git | ||
| shell: bash | ||
| run: | | ||
| git config --local user.email "bot@reactnative.dev" | ||
| git config --local user.name "React Native Bot" | ||
| - name: Validate DotSlash artifacts | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| const {validateDotSlashArtifacts} = require('./scripts/releases/validate-dotslash-artifacts.js'); | ||
| await validateDotSlashArtifacts(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| * @flow strict-local | ||
| * @format | ||
| */ | ||
|
|
||
| declare module '@expo/spawn-async' { | ||
| type SpawnOptions = { | ||
| cwd?: string, | ||
| env?: Object, | ||
| argv0?: string, | ||
| stdio?: string | Array<any>, | ||
| detached?: boolean, | ||
| uid?: number, | ||
| gid?: number, | ||
| shell?: boolean | string, | ||
| windowsVerbatimArguments?: boolean, | ||
| windowsHide?: boolean, | ||
| encoding?: string, | ||
| ignoreStdio?: boolean, | ||
| }; | ||
|
|
||
| declare class SpawnPromise<T> extends Promise<T> { | ||
| child: child_process$ChildProcess; | ||
| } | ||
| type SpawnResult = { | ||
| pid?: number, | ||
| output: string[], | ||
| stdout: string, | ||
| stderr: string, | ||
| status: number | null, | ||
| signal: string | null, | ||
| }; | ||
|
|
||
| declare function spawnAsync( | ||
| command: string, | ||
| args?: $ReadOnlyArray<string>, | ||
| options?: SpawnOptions, | ||
| ): SpawnPromise<SpawnResult>; | ||
|
|
||
| declare module.exports: typeof spawnAsync; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /** | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| * @flow strict-local | ||
| * @format | ||
| */ | ||
|
|
||
| // Partial types for Octokit based on the usage in react-native-github | ||
| declare module '@octokit/rest' { | ||
| declare class Octokit { | ||
| constructor(options?: {auth?: string, ...}): this; | ||
|
|
||
| repos: $ReadOnly<{ | ||
| listReleaseAssets: ( | ||
| params: $ReadOnly<{ | ||
| owner: string, | ||
| repo: string, | ||
| release_id: string, | ||
| }>, | ||
| ) => Promise<{ | ||
| data: Array<{ | ||
| id: string, | ||
| name: string, | ||
| ... | ||
| }>, | ||
| ... | ||
| }>, | ||
| uploadReleaseAsset: ( | ||
| params: $ReadOnly<{ | ||
| owner: string, | ||
| repo: string, | ||
| release_id: string, | ||
| name: string, | ||
| data: Buffer, | ||
| headers: $ReadOnly<{ | ||
| 'content-type': string, | ||
| ... | ||
| }>, | ||
| ... | ||
| }>, | ||
| ) => Promise<{ | ||
| data: { | ||
| browser_download_url: string, | ||
| ... | ||
| }, | ||
| ... | ||
| }>, | ||
| deleteReleaseAsset: (params: { | ||
| owner: string, | ||
| repo: string, | ||
| asset_id: string, | ||
| ... | ||
| }) => Promise<mixed>, | ||
| }>; | ||
| } | ||
|
|
||
| declare export {Octokit}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| * @flow strict-local | ||
| * @format | ||
| */ | ||
|
|
||
| declare module 'fb-dotslash' { | ||
| declare module.exports: string; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.