Skip to content

feat: add method to reload banner ad #917

feat: add method to reload banner ad

feat: add method to reload banner ad #917

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'
jobs:
main:
name: Create patch-package Patches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# 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.
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
name: Yarn Cache
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
- name: Yarn Install
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: DETOX_DISABLE_POSTINSTALL=1 yarn --no-audit --prefer-offline
- name: Create Patches
run: |
export PACKAGE_NAME=`npx json name -f package.json`
export CLEAN_PACKAGE_NAME=`echo $PACKAGE_NAME | sed s/@// |sed s,/,-,`
mkdir $HOME/scratch
echo "Packing PR version of $CLEAN_PACKAGE_NAME"
yarn pack
mv *tgz $HOME/scratch
ls -la $HOME/scratch/*$CLEAN_PACKAGE_NAME*
cd $HOME
npx react-native init template
cd template
yarn add patch-package --save-dev
mkdir patches || true
echo "Installing $CLEAN_PACKAGE_NAME into fresh template app, then clobbering with PR version"
yarn add $PACKAGE_NAME
pushd node_modules/
tar -zxf $HOME/scratch/*$CLEAN_PACKAGE_NAME*-v*
mv react-native-google-mobile-ads/package.json package/
\rm -fr react-native-google-mobile-ads
mv package react-native-google-mobile-ads
popd
npx patch-package $PACKAGE_NAME || true
ls -la $HOME/template/patches
shell: bash
- name: Upload Test Patches
uses: actions/upload-artifact@v3
with:
name: patches
path: ~/template/patches/
# 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) }}