Skip to content

build(deps): react-native 0.73 as well as other deps #3458

build(deps): react-native 0.73 as well as other deps

build(deps): react-native 0.73 as well as other deps #3458

name: 'Create Test Patches'
on:
workflow_dispatch:
push:
branches:
- '**'
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main:
name: Create patch-package Patches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Future ideas:
# - make into an action, parameterize directories to pack, and package names to install
# - name patches w/PR as "semver prerelease" and SHA as "semver build info". Needs patch-package enhancement.
# FIXME: when github runner bumped from 18.17.1 to 18.18+ we started seeing template copy errors
# different files, could reproduce locally on linux with v18.18+ and v20.8.0. Pinning to
# prior version (18.17.1) to see if it stabilizes
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- uses: actions/cache/restore@v3
name: Yarn Cache Restore
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-v1
- name: Yarn Install
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
retry_wait_seconds: 60
max_attempts: 3
command: DETOX_DISABLE_POSTINSTALL=1 yarn && yarn lerna:prepare
- name: Create Patches
run: |
PACKAGE_LIST=`find packages -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | egrep -v 'template|invites'`
mkdir $HOME/packages
for PACKAGE in $PACKAGE_LIST; do
echo "Packing PR version of package $PACKAGE"
pushd packages/$PACKAGE;
yarn pack;
mv package.tgz $HOME/packages/react-native-firebase-${PACKAGE}.tgz;
ls -la $HOME/packages/*${PACKAGE}*
popd;
done
ls -la $HOME/packages/
cd $HOME
npx react-native init template
cd template
yarn add patch-package --save-dev
mkdir patches || true
for PACKAGE in $PACKAGE_LIST; do
echo "Installing package $PACKAGE into fresh template app, then clobbering with PR version"
yarn add @react-native-firebase/$PACKAGE || true
if [ -d node_modules/@react-native-firebase/$PACKAGE ]; then
pushd node_modules/@react-native-firebase
tar -zxf $HOME/packages/react-native-firebase-${PACKAGE}.tgz
mv $PACKAGE/package.json package/
\rm -fr $PACKAGE
mv package $PACKAGE
popd
npx patch-package @react-native-firebase/$PACKAGE || true
fi
done
ls -la $HOME/template/patches
shell: bash
- name: Upload Test Patches
uses: actions/upload-artifact@v3
with:
name: patches
path: ~/template/patches/
- uses: actions/cache/save@v3
name: Yarn Cache Save
if: "${{ github.ref == 'refs/heads/main' }}"
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
# create a comment on the PR and any related issues with a direct link to the archive,
# a call for testers, and perhaps a paste-able set of commands to install them
# (mkdir patches, curl -o etc, npx patch-package)
# You need an artifact id to get a download link for it.
# You need a workflow run id to get an artifact id.
# You need to list out all runs for a workflow and filter to get the run id.
# This action does all of that but needs a tweak to just kick out the URL instead of downloading:
# https://github.com/dawidd6/action-download-artifact/blob/master/main.js#L102
# Best strategy is to run this patch generator on pull_request
# Then run the issue commenter that dynamically de-references the artifact on workflow_run
# - name: Post Comment with Download Link
# run: echo ${{ toJson(github) }}