mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b4a2a4e756
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46034 The create release workflow was not working properly for 0.75: * the latest tag was not pushed because we were using the wrong input * the latest tag was not deleted because we were not fetching all the tags * the create release job 'dry-run' defaults to false, which is a bit dangerous This change is a backport from 0.75 to main of these changes. ## Changelog [Internal] - Make sure that the Latest tag is properly pushed to github while releasing Reviewed By: cortinico Differential Revision: D61331247 fbshipit-source-id: 89bf0698c45ec6c766e25b11599dbe926d8a6297
57 lines
1.9 KiB
YAML
57 lines
1.9 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: true
|
|
|
|
jobs:
|
|
create_release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
|
fetch-depth: 0
|
|
fetch-tags: 'true'
|
|
- 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
|
|
with:
|
|
version: ${{ inputs.version }}
|
|
is-latest-on-npm: ${{ inputs.is-latest-on-npm }}
|
|
dry-run: ${{ inputs.dry-run }}
|