Local Build #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Local Build | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseChannel: | |
type: choice | |
description: "type of release" | |
required: true | |
default: "alpha" | |
options: | |
- alpha | |
- beta | |
- release | |
jobs: | |
build-dependencies: | |
name: Build dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for EXPO_TOKEN | |
run: | | |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then | |
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions" | |
exit 1 | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.* | |
cache: yarn | |
cache-dependency-path: "**/yarn.lock" | |
- name: 1) [shared] Install dependencies | |
run: yarn --frozen-lockfile | |
working-directory: packages/shared/ | |
- name: 1) [shared] Build | |
run: yarn build | |
working-directory: packages/shared/ | |
# Need to upload it so that the subsequent jobs can access it | |
- name: 1) [shared] Upload build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: shared-dist | |
path: packages/shared/dist | |
# This gave an answer of 135,210 bytes. | |
# That's pretty close? I'm expecting 138,443 | |
- name: Debugging - Print Yarn Lock Size (Before) | |
run: | | |
yarn_lock_size=$(stat -c %s yarn.lock) | |
echo "Size of yarn.lock: $yarn_lock_size bytes" | |
working-directory: packages/web/ | |
if: matrix.os == 'ubuntu-latest' | |
- name: 2) [web] Install dependencies | |
# run: yarn --frozen-lockfile # TODO: --frozen-lockfile is erroring out, saying it must be updated. But it doesn't do that on my local machine. Why does it do that on the Github runner? Both seem to be using the same yarn version, 1.22.19 | |
run: yarn | |
working-directory: packages/web/ | |
- name: Debugging - Print Yarn Lock Size (After) | |
run: | | |
yarn_lock_size=$(stat -c %s yarn.lock) | |
echo "Size of yarn.lock: $yarn_lock_size bytes" | |
working-directory: packages/web/ | |
- name: 2) [web] Build | |
run: yarn build | |
working-directory: packages/web/ | |
# Need to upload it so that the subsequent jobs can access it | |
- name: 2) [web] Upload build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-dist | |
path: packages/web/dist | |
build-mobile: | |
name: Build ${{ matrix.platform }} binaries | |
needs: build-dependencies | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: packages/mobile | |
strategy: | |
matrix: | |
platform: [android, ios] | |
include: | |
- os: ubuntu-latest | |
platform: android | |
- os: macos-latest | |
platform: ios | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.* | |
cache: yarn | |
cache-dependency-path: "**/yarn.lock" | |
- name: 1) [shared] Download dist folder artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: shared-dist | |
path: packages/shared/dist | |
- name: 2) [web] Download dist folder artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: web-dist | |
path: packages/web/dist | |
- name: 3) [${{ matrix.platform }}] Install dependencies | |
# run: yarn --frozen-lockfile # TODO: --frozen-lockfile is erroring out, saying it must be updated. But it doesn't do that on my local machine. Why does it do that on the Github runner? Both seem to be using the same yarn version, 1.22.19 | |
run: yarn | |
- name: 3) [${{ matrix.platform }}] Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
# Inspired by: https://github.com/suiet/suiet/blob/63b50e4ba225b294af1018f3f98b9666738837c7/.github/workflows/build-app.yml#L9 | |
- name: 3) [${{ matrix.platform }}] EAS Local Build | |
run: eas build --local --platform ${{ matrix.platform }} --profile ${{ github.event.inputs.releaseChannel }} --non-interactive | |
- name: Print Folder Structure | |
run: | | |
echo "Folder structure:" | |
tree -L 3 --dirsfirst | |
if: matrix.os == 'ubuntu-latest' | |
- name: 📱 Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BloomReaderLite-${{ matrix.platform }}-${{ inputs.releaseChannel }} | |
path: packages/mobile/build-* | |
build-electron: | |
name: Build electron binaries | |
needs: build-dependencies | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/electron-demo | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.* | |
cache: yarn | |
cache-dependency-path: "packages/electron-demo/yarn.lock" | |
- name: 1) [shared] Download dist folder artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: shared-dist | |
path: packages/shared/dist | |
- name: 2) [web] Download dist folder artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: web-dist | |
path: packages/web/dist | |
- name: 3) [electron] Install dependencies | |
run: yarn | |
- name: 3) [electron] Build | |
run: yarn build | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BloomReaderLite-electron-${{ inputs.releaseChannel }} | |
path: packages/electron-demo/output/* | |
cleanup: | |
runs-on: ubuntu-latest | |
name: Cleanup | |
needs: [build-mobile, build-electron] | |
steps: | |
- name: Delete temporary artifacts | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: | | |
shared-dist | |
web-dist |