mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ece68f0efd
Summary: This change removes the need for the trigger-react-native-release.js script. Thanks to the migration to Github Actions, we can now leverage the GHA workflow UI to trigger a Prepare Release job that creates a github tag that will spin a new release. The pro of this approach are: - less code to maintain: instead of a complex trigger release scripts, we only have to maintain two very straightforward scripts for the CI - easier to trigger a release: instead of running a script, we can now just use the GH UI The `trigger-react-native-release` script was doing the following steps: - check that we are in the release branch ==> Already implemented in the GHA workflow - Gets the branch name (not needed) ==> the job will automatically run on the stable branch - Check for unsent changes (not needed) ==> we are not in a local environment - get the gh token (not needed) ==> You need to be logged in GH and have write access to the repo - get the version ==> provided as a parameter - fails if the tag is already there ==> Functionality added in the workflow - Parse and validate the version ==> Functionality added to the action prepare-release action + the JS Script - Compute the npmTag ==> Functionality added to the action prepare-release action + the JS Script - trigger the release workflow ==> The GH UI does that for us ## Changelog: [Internal] - Remove the trigger-react-native-release.js Pull Request resolved: https://github.com/facebook/react-native/pull/44898 Test Plan: Testing in Production! Reviewed By: cortinico, huntie Differential Revision: D58461470 Pulled By: cipolleschi fbshipit-source-id: 32bb0ee91370c9483a29e2ca2e18e24557d5fd53
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
name: Create release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'The version of React Native we want to release. For example 0.75.0-rc.0'
|
|
required: true
|
|
type: string
|
|
is_latest_on_npm:
|
|
description: 'Whether we want to tag this release as latest on NPM'
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
dry_run:
|
|
description: 'Whether the job should be executed in dry-run mode or not'
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
prepare_release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Check if on stable branch
|
|
id: check_stable_branch
|
|
run: |
|
|
BRANCH="$(git branch --show-current)"
|
|
PATTERN='^0\.[0-9]+-stable$'
|
|
if [[ $BRANCH =~ $PATTERN ]]; then
|
|
echo "On a stable branch"
|
|
echo "ON_STABLE_BRANCH=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: Print output
|
|
run: echo "ON_STABLE_BRANCH ${{steps.check_stable_branch.outputs.ON_STABLE_BRANCH}}"
|
|
- name: Check if tag already exists
|
|
id: check_if_tag_exists
|
|
run: |
|
|
TAG="v${{ inputs.version }}"
|
|
TAG_EXISTS=$(git tag -l "$TAG")
|
|
if [[ -n "$TAG_EXISTS" ]]; then
|
|
echo "Version tag already exists!"
|
|
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: Execute Prepare Release
|
|
if: ${{ steps.check_stable_branch.outputs.ON_STABLE_BRANCH && !steps.check_if_tag_exists.outputs.TAG_EXISTS }}
|
|
uses: ./.github/actions/create-release
|