@@ -10,12 +10,14 @@ permissions:
1010 contents : read
1111
1212env :
13- # The demo's build step asks no API: these builds are never shipped.
13+ # The build step asks no API: these builds are never shipped.
1414 HOTCODEPUSH_OFFLINE : ' 1'
1515 JAVA_VERSION : 21
1616
1717# The native code compiles inside an app: the platform jobs install the package from this commit into the demo at
1818# the commit the baseline names and build it. Debug builds, which bundle no JavaScript and so create no binary.
19+ # The newest-react-native jobs install it into a fresh app on React Native's latest release instead and build a release,
20+ # which runs the build step.
1921jobs :
2022 javascript :
2123 name : Lint, typecheck, test and build the JavaScript
9294 run : node package/benchmarks/prepare-demo.mjs demo "$RUNNER_TEMP/with" with "$(ls "$RUNNER_TEMP"/hotcodepush-react-native-code-push-*.tgz)"
9395 - run : xcodebuild -workspace HotCodePushDemo.xcworkspace -scheme HotCodePushDemo -configuration Debug -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO -quiet build
9496 working-directory : ${{ runner.temp }}/with/ios
97+ newest-react-native :
98+ name : Build a release of a fresh app on the newest React Native for ${{ matrix.platform }}
99+ runs-on : ${{ matrix.runner }}
100+ strategy :
101+ fail-fast : false
102+ matrix :
103+ include :
104+ - platform : android
105+ runner : ubuntu-latest
106+ - platform : ios
107+ runner : macos-latest
108+ steps :
109+ - uses : actions/checkout@v7
110+ with :
111+ path : package
112+ - name : Read the pinned demo commit
113+ id : baseline
114+ run : echo "demo=$(node -p "require('./package/benchmarks/baseline.json').demo.commit")" >> "$GITHUB_OUTPUT"
115+ - uses : actions/checkout@v7
116+ with :
117+ repository : hotcodepush-team/react-native-code-push-demo
118+ ref : ${{ steps.baseline.outputs.demo }}
119+ path : demo
120+ - uses : maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
121+ if : matrix.platform == 'ios'
122+ with :
123+ xcode-version : latest-stable
124+ - uses : actions/setup-node@v6
125+ with :
126+ node-version-file : package/.nvmrc
127+ - uses : actions/setup-java@v5
128+ if : matrix.platform == 'android'
129+ with :
130+ distribution : zulu
131+ java-version : ${{ env.JAVA_VERSION }}
132+ - uses : gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
133+ if : matrix.platform == 'android'
134+ - name : Pack the package from this commit
135+ working-directory : package
136+ run : npm ci && npm run build && npm pack --pack-destination "$RUNNER_TEMP"
137+ - name : Create a fresh app on the newest React Native
138+ run : |
139+ version=$(npm view react-native@latest version)
140+ echo "::notice::React Native $version"
141+ npx @react-native-community/cli@latest init LatestApp --version "$version" --directory app --skip-install --skip-git-init
142+ - name : Install the package from this commit and the CLI the demo pins
143+ working-directory : app
144+ run : npm install "$RUNNER_TEMP"/hotcodepush-react-native-code-push-*.tgz "$(node -p "require('../demo/package.json').devDependencies.hotcodepush")"
145+ - name : Drop the iOS project, whose pod install needs macOS
146+ if : matrix.platform == 'android'
147+ run : rm -rf app/ios
148+ # init signs in before it configures and wires, which a pipeline cannot: the demo's hotcodepush.json stands in
149+ # for its configuration step, and its hook step is the CLI's own wiring module, called as init --yes calls it.
150+ - name : Configure and wire the app as init does
151+ working-directory : app
152+ run : |
153+ cp ../demo/hotcodepush.json .
154+ node --input-type=module --eval "
155+ import { readFileSync } from 'node:fs';
156+ import { reactNativeFramework } from 'hotcodepush/dist/utils/frameworks/react-native.js';
157+ const project = { directoryPath: process.cwd(), packageJson: JSON.parse(readFileSync('package.json', 'utf8')) };
158+ const wiring = await reactNativeFramework.resolveWiring(project, { yes: true });
159+ console.log((await wiring.wireBinaryCreateStep(undefined)).message);
160+ "
161+ - name : Build the Android release and check the build step wrote hotcodepush.json
162+ if : matrix.platform == 'android'
163+ working-directory : app/android
164+ run : |
165+ ./gradlew assembleRelease --console=plain
166+ unzip -l app/build/outputs/apk/release/app-release.apk assets/hotcodepush.json
167+ - name : Build the iOS release and check the build step wrote hotcodepush.json
168+ if : matrix.platform == 'ios'
169+ working-directory : app/ios
170+ run : |
171+ xcodebuild -workspace LatestApp.xcworkspace -scheme LatestApp -configuration Release -destination 'generic/platform=iOS Simulator' -derivedDataPath DerivedData CODE_SIGNING_ALLOWED=NO -quiet build
172+ ls -l DerivedData/Build/Products/Release-iphonesimulator/LatestApp.app/hotcodepush.json
95173 preview :
96174 name : Publish the preview build to pkg.pr.new
97175 runs-on : ubuntu-latest
0 commit comments