From 90d4d551220b7bbd2cf10722ae09fb978bf119fe Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 20 Jun 2024 03:24:29 -0700 Subject: [PATCH] Port Create Release fixes from Stable to main (#45063) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45063 While doing the release of 0.75, we have to fix the Create Release action a few times to get it right. This change contains the fixes from * https://github.com/facebook/react-native/commit/e36b46f0c970dc3f1f5b5058a8d10834acdb2667 * https://github.com/facebook/react-native/commit/1b891357b2f1995f2344cc991be423ca66fa6770 * https://github.com/facebook/react-native/commit/56e1c8bfdd57600e79c0b17de1d2fd933d20b8f9 * https://github.com/facebook/react-native/commit/03591318fbabdc0c06808316f471cc361b53c57f * https://github.com/facebook/react-native/commit/528097709aeef434b0d85565bfd89a4a9ff5644e * https://github.com/facebook/react-native/commit/f4b1dd1fa11374cae8a696833ad9ded0767cba8f ## Changelog [Internal] - Backport changes to Create Release github action Reviewed By: cortinico Differential Revision: D58782391 fbshipit-source-id: b68088fb8c4290efcb4599d1b090b18e401e4b66 --- .github/actions/create-release/action.yml | 18 +++++++++++++++++- .github/workflows/create-release.yml | 8 +++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-release/action.yml b/.github/actions/create-release/action.yml index cce43d9348b..fb52223504f 100644 --- a/.github/actions/create-release/action.yml +++ b/.github/actions/create-release/action.yml @@ -1,11 +1,27 @@ name: create_release description: Creates a new React Native release +inputs: + version: + description: 'The version of React Native we want to release. For example 0.75.0-rc.0' + required: true + is_latest_on_npm: + description: 'Whether we want to tag this release as latest on NPM' + required: true + default: "false" + dry_run: + description: 'Whether the job should be executed in dry-run mode or not' + default: "true" runs: using: composite steps: - name: Yarn install shell: bash run: yarn install --non-interactive + - name: Configure Git + shell: bash + run: | + git config --local user.email "bot@reactnative.dev" + git config --local user.name "React Native Bot" - name: Creating release commit shell: bash run: | @@ -23,7 +39,7 @@ runs: git tag -a "latest" -m "latest" - name: Pushing release commit shell: bash - if: ${{ inputs.dry_run == false }} + if: ${{ inputs.dry_run == 'false' }} run: | CURR_BRANCH="$(git branch --show-current)" git push origin "$CURR_BRANCH" --follow-tags diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 85e14987843..07e46d8a7a1 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -18,11 +18,13 @@ on: default: false jobs: - prepare_release: + create_release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4.1.1 + with: + token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} - name: Check if on stable branch id: check_stable_branch run: | @@ -46,3 +48,7 @@ jobs: - 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 }}