mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Some of the previous commits changed the names of the parameters on one side and not in another, and GHA is emitting some warnings. This change should fix them ## Changelog: [Internal] - Fix GHA CI warnings Pull Request resolved: https://github.com/facebook/react-native/pull/45494 Test Plan: | BEFORE | AFTER | | --- | --- | | <img width="1507" alt="Screenshot 2024-07-17 at 14 20 54" src="https://github.com/user-attachments/assets/6703e554-ad74-4fd6-96ba-18baf5e71a52"> | <img width="1718" alt="Screenshot 2024-07-17 at 14 23 31" src="https://github.com/user-attachments/assets/8bb7bd4a-5bd4-417f-9c8a-e7e8db4ba412"> | Reviewed By: robhogan Differential Revision: D59857004 Pulled By: cipolleschi fbshipit-source-id: e8c5050682aba4952e3a2b0c7a660155813d19f1
356 lines
15 KiB
YAML
356 lines
15 KiB
YAML
name: Publish Release
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v0.*.*" # This should match v0.X.Y
|
|
- "v0.*.*-rc.*" # This should match v0.X.Y-RC.0
|
|
jobs:
|
|
set_release_type:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'facebook/react-native'
|
|
outputs:
|
|
RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }}
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
REF: ${{ github.ref }}
|
|
steps:
|
|
- id: set_release_type
|
|
run: |
|
|
echo "Setting release type to release"
|
|
echo "RELEASE_TYPE=release" >> $GITHUB_OUTPUT
|
|
|
|
prepare_hermes_workspace:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
HERMES_VERSION_FILE: packages/react-native/sdks/.hermesversion
|
|
outputs:
|
|
react-native-version: ${{ steps.prepare-hermes-workspace.outputs.react-native-version }}
|
|
hermes-version: ${{ steps.prepare-hermes-workspace.outputs.hermes-version }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Prepare Hermes Workspace
|
|
id: prepare-hermes-workspace
|
|
uses: ./.github/actions/prepare-hermes-workspace
|
|
with:
|
|
hermes-ws-dir: ${{ env.HERMES_WS_DIR }}
|
|
hermes-version-file: ${{ env.HERMES_VERSION_FILE }}
|
|
build-from-source: ${{ env.BUILD_FROM_SOURCE }}
|
|
|
|
build_hermesc_apple:
|
|
runs-on: macos-13
|
|
needs: prepare_hermes_workspace
|
|
env:
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build HermesC Apple
|
|
uses: ./.github/actions/build-hermesc-apple
|
|
with:
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.output.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.output.react-native-version }}
|
|
build_apple_slices_hermes:
|
|
runs-on: macos-14
|
|
needs: [build_hermesc_apple, prepare_hermes_workspace]
|
|
env:
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
|
|
HERMES_OSXBIN_ARTIFACTS_DIR: /tmp/hermes/osx-bin
|
|
IOS_DEPLOYMENT_TARGET: "13.4"
|
|
XROS_DEPLOYMENT_TARGET: "1.0"
|
|
MAC_DEPLOYMENT_TARGET: "10.15"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flavor: [Debug, Release]
|
|
slice: [macosx, iphoneos, iphonesimulator, catalyst, xros, xrsimulator]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build Slice
|
|
uses: ./.github/actions/build-apple-slices-hermes
|
|
with:
|
|
flavor: ${{ matrix.flavor }}
|
|
slice: ${{ matrix.slice}}
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
|
|
|
build_hermes_macos:
|
|
runs-on: macos-13
|
|
needs: [build_apple_slices_hermes, prepare_hermes_workspace]
|
|
env:
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
|
|
continue-on-error: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flavor: [Debug, Release]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build Hermes MacOS
|
|
uses: ./.github/actions/build-hermes-macos
|
|
with:
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
|
flavor: ${{ matrix.flavor }}
|
|
|
|
build_hermesc_linux:
|
|
runs-on: ubuntu-latest
|
|
needs: prepare_hermes_workspace
|
|
env:
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build HermesC Linux
|
|
uses: ./.github/actions/build-hermesc-linux
|
|
with:
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
|
|
|
build_hermesc_windows:
|
|
runs-on: windows-2019
|
|
needs: prepare_hermes_workspace
|
|
env:
|
|
HERMES_WS_DIR: 'D:\tmp\hermes'
|
|
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
|
|
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
|
|
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
|
|
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
|
|
CMAKE_DIR: 'C:\Program Files\CMake\bin'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build HermesC Windows
|
|
uses: ./.github/actions/build-hermesc-windows
|
|
with:
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
|
|
|
build_android:
|
|
runs-on: 8-core-ubuntu
|
|
needs: [set_release_type]
|
|
container:
|
|
image: reactnativecommunity/react-native-android:latest
|
|
env:
|
|
TERM: "dumb"
|
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
|
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
|
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
|
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
|
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Build Android
|
|
uses: ./.github/actions/build-android
|
|
with:
|
|
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
|
|
|
build_npm_package:
|
|
runs-on: 8-core-ubuntu
|
|
needs:
|
|
[
|
|
set_release_type,
|
|
prepare_hermes_workspace,
|
|
build_hermes_macos,
|
|
build_hermesc_linux,
|
|
build_hermesc_windows,
|
|
build_android,
|
|
]
|
|
container:
|
|
image: reactnativecommunity/react-native-android:latest
|
|
env:
|
|
TERM: "dumb"
|
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
|
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
|
|
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
|
|
HERMES_WS_DIR: /tmp/hermes
|
|
env:
|
|
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
|
|
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
|
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
|
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
|
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
|
REACT_NATIVE_BOT_GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.1.1
|
|
- name: Setup git safe folders
|
|
run: git config --global --add safe.directory '*'
|
|
- name: Create /tmp/hermes/osx-bin directory
|
|
run: mkdir -p /tmp/hermes/osx-bin
|
|
- name: Download osx-bin release artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-osx-bin-Release
|
|
path: /tmp/hermes/osx-bin/Release
|
|
- name: Download osx-bin debug artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-osx-bin-Debug
|
|
path: /tmp/hermes/osx-bin/Debug
|
|
- name: Download darwin-bin release artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-darwin-bin-Release
|
|
path: /tmp/hermes/hermes-runtime-darwin
|
|
- name: Download darwin-bin debug artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-darwin-bin-Debug
|
|
path: /tmp/hermes/hermes-runtime-darwin
|
|
- name: Download hermes dSYM debug artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-dSYM-Debug
|
|
path: /tmp/hermes/dSYM/Debug
|
|
- name: Download hermes dSYM release vartifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-dSYM-Release
|
|
path: /tmp/hermes/dSYM/Release
|
|
- name: Download windows-bin artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-win64-bin
|
|
path: /tmp/hermes/win64-bin
|
|
- name: Download linux-bin artifacts
|
|
uses: actions/download-artifact@v4.1.3
|
|
with:
|
|
name: hermes-linux-bin
|
|
path: /tmp/hermes/linux64-bin
|
|
- name: Cache setup
|
|
id: cache-setup
|
|
uses: ./.github/actions/cache-setup
|
|
with:
|
|
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
|
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
|
- name: Show /tmp/hermes directory
|
|
run: ls -lR /tmp/hermes
|
|
- name: Copy Hermes binaries
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ./packages/react-native/sdks/hermesc ./packages/react-native/sdks/hermesc/osx-bin ./packages/react-native/sdks/hermesc/win64-bin ./packages/react-native/sdks/hermesc/linux64-bin
|
|
|
|
# When build_hermes_macos runs as a matrix, it outputs
|
|
if [[ -d $HERMES_WS_DIR/osx-bin/Release ]]; then
|
|
cp -r $HERMES_WS_DIR/osx-bin/Release/* ./packages/react-native/sdks/hermesc/osx-bin/.
|
|
elif [[ -d $HERMES_WS_DIR/osx-bin/Debug ]]; then
|
|
cp -r $HERMES_WS_DIR/osx-bin/Debug/* ./packages/react-native/sdks/hermesc/osx-bin/.
|
|
else
|
|
ls $HERMES_WS_DIR/osx-bin || echo "hermesc macOS artifacts directory missing."
|
|
echo "Could not locate macOS hermesc binary."; exit 1;
|
|
fi
|
|
|
|
# Sometimes, GHA creates artifacts with lowercase Debug/Release. Make sure that if it happen, we uppercase them.
|
|
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-debug.tar.gz" ]]; then
|
|
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-debug.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz"
|
|
fi
|
|
|
|
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-release.tar.gz" ]]; then
|
|
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-release.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz"
|
|
fi
|
|
|
|
cp -r $HERMES_WS_DIR/win64-bin/* ./packages/react-native/sdks/hermesc/win64-bin/.
|
|
cp -r $HERMES_WS_DIR/linux64-bin/* ./packages/react-native/sdks/hermesc/linux64-bin/.
|
|
|
|
# Make sure the hermesc files are actually executable.
|
|
chmod -R +x packages/react-native/sdks/hermesc/*
|
|
|
|
mkdir -p ./packages/react-native/ReactAndroid/external-artifacts/artifacts/
|
|
cp $HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-ios-debug.tar.gz
|
|
cp $HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-ios-release.tar.gz
|
|
cp $HERMES_WS_DIR/dSYM/Debug/hermes.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-debug.tar.gz
|
|
cp $HERMES_WS_DIR/dSYM/Release/hermes.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-release.tar.gz
|
|
- name: Setup node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Setup gradle
|
|
uses: ./.github/actions/setup-gradle
|
|
- name: Install dependencies
|
|
run: yarn install --non-interactive
|
|
- name: Build packages
|
|
run: yarn build
|
|
# Continue with publish steps
|
|
- name: Set npm credentials
|
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.GHA_NPM_TOKEN }}" > ~/.npmrc
|
|
- name: Publish NPM
|
|
run: |
|
|
echo "GRADLE_OPTS = $GRADLE_OPTS"
|
|
export ORG_GRADLE_PROJECT_reactNativeArchitectures="armeabi-v7a,arm64-v8a,x86,x86_64"
|
|
node ./scripts/releases-ci/publish-npm.js -t release
|
|
- name: Upload npm logs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: npm-logs
|
|
path: ~/.npm/_logs
|
|
- name: Build release package as a job artifact
|
|
if: needs.set_release_type.outputs.RELEASE_TYPE == 'dry-run'
|
|
run: |
|
|
mkdir -p build
|
|
|
|
FILENAME=$(cd packages/react-native; npm pack | tail -1)
|
|
mv packages/react-native/$FILENAME build/
|
|
|
|
echo $FILENAME > build/react-native-package-version
|
|
- name: Upload release package
|
|
uses: actions/upload-artifact@v4
|
|
if: needs.set_release_type.outputs.RELEASE_TYPE == 'dry-run'
|
|
with:
|
|
name: react-native-package
|
|
path: build
|
|
- name: Publish @react-native-community/template
|
|
if: needs.set_release_type.outputs.RELEASE_TYPE == 'release'
|
|
id: publish-to-npm
|
|
run: |
|
|
COMMIT_MSG=$(git log -n1 --pretty=%B);
|
|
if grep -q '#publish-packages-to-npm&latest' <<< "$COMMIT_MSG"; then
|
|
echo "TAG=latest" >> $GITHUB_OUTPUT
|
|
IS_LATEST=true
|
|
else
|
|
IS_LATEST=false
|
|
fi
|
|
# Go from v0.75.0-rc.4 -> 0.75-stable, which is the template's branching scheme
|
|
VERSION=$(grep -oE '\d+\.\d+' <<< "${{ github.ref_name }}" | { read version; echo "$version-stable" })
|
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
curl -L -X POST https://api.github.com/repos/react-native-community/template/release.yaml/dispatches \
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
-H "Authorization: Bearer $REACT_NATIVE_BOT_GITHUB_TOKEN" \
|
|
-d "{\"ref\":\"$VERSION\",\"inputs\":{\"version\":\"${{ github.ref_name }}\",\"is_latest_on_npm\":\"$IS_LATEST\"}}\n"
|
|
- name: Wait for template to be published
|
|
if: needs.set_release_type.outputs.RELEASE_TYPE == 'release'
|
|
timeout-minutes: 3
|
|
env:
|
|
VERSION: ${{ steps.publish-to-npm.outputs.VERSION }}
|
|
TAG: ${{ steps.publish-to-npm.outputs.TAG }}
|
|
run: |
|
|
echo "Waiting until @react-native-community/template is published to npm"
|
|
while true; do
|
|
if curl -o /dev/null -s -f "https://registry.npmjs.org/@react-native-community/template/$VERSION"; then
|
|
echo "Confirm that @react-native-community/template@$VERSION is published on npm"
|
|
break
|
|
fi
|
|
sleep 10
|
|
done
|
|
while [ "$TAG" == "latest" ]; do
|
|
CURRENT=$(curl -s "https://registry.npmjs.org/react-native/latest" | jq -r '.version');
|
|
if [ "$CURRENT" == "$VERSION" ]; then
|
|
echo "Confirm that @react-native-community/template@latest == $VERSION on npm"
|
|
break
|
|
fi
|
|
sleep 10
|
|
done
|
|
- name: Update rn-diff-purge to generate upgrade-support diff
|
|
if: needs.set_release_type.outputs.RELEASE_TYPE == 'release'
|
|
run: |
|
|
curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
-H "Authorization: Bearer $REACT_NATIVE_BOT_GITHUB_TOKEN" \
|
|
-d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"${{ github.ref_name }}\" }}"
|