Skip to content

v3.0.3

v3.0.3 #26

# Create production builds for web, ios and android, and deploy to relevant providers
name: Generate Screenshots
on:
release:
types: [published]
jobs:
build_dist:
name: Build Production
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Setup Cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install
- name: Populate Config
run: echo $FIREBASE_CONFIG_JSON > maths-club-app/src/environments/firebaseConfig.json
env:
FIREBASE_CONFIG_JSON: ${{secrets.FIREBASE_CONFIG_JSON}}
- name: Build and Copy
run: cd maths-club-app && npm run build
# Store various folders as artifacts for use by other jobs (ignore node modules except those needed by capacitor)
- name: Store Build Artifact
uses: actions/upload-artifact@v2
with:
name: maths-club-app
path: |
maths-club-app
!maths-club-app/node_modules
ios_screenshot:
needs: [build_dist]
name: Create IOS Screenshots
runs-on: macos-latest
timeout-minutes: 35
continue-on-error: true
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: maths-club-app
- name: Setup Cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install --silent
- name: Sync capacitor plugins
run: npx cap sync ios
- name: Setup environment
run: |
cd ios/App
echo $MOBILEPROVISION_BASE64 | base64 --decode > ios-build.mobileprovision
echo $GOOGLE_SERVICES_PLIST_BASE64 | base64 --decode > App/GoogleService-Info.plist
env:
MOBILEPROVISION_BASE64: ${{secrets.IOS_PROVISION_BASE64}}
GOOGLE_SERVICES_PLIST_BASE64: ${{secrets.GOOGLE_SERVICES_PLIST_BASE64}}
- name: Install Dependencies
run: |
cd ios/App
sudo gem install bundler && sudo gem install cocoapods && sudo bundle install && pod install
- name: Generate Screenshots
run: |
cd ios/App
bundle exec fastlane ios screenshots --verbose
- name: Upload Screenshots
uses: actions/upload-artifact@v2
with:
name: screenshots_ios
path: |
ios/App/screenshots
android_screenshot:
needs: [build_dist]
name: Create Android Screenshots
runs-on: macos-latest
timeout-minutes: 45
continue-on-error: true
strategy:
matrix:
profile: ["Nexus 5X", "Nexus 7", "Nexus 10"]
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: maths-club-app
- name: Setup Cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install --silent
- name: Sync capacitor plugins
run: npx cap sync android
# - name: Setup Cache
# uses: actions/cache@v4
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Write Google Services Json
run: echo $GOOGLE_SERVICES_JSON > android/app/google-services.json
env:
GOOGLE_SERVICES_JSON: ${{secrets.GOOGLE_SERVICES_JSON}}
- name: Generate debug android and test builds
run: cd android && chmod +x ./gradlew && ./gradlew clean :app:assembleDebug :app:assembleDebugAndroidTest
- name: Install Dependencies
run: |
cd ci
sudo gem install bundler && sudo bundle install
- name: Generate Nexus Screenshots
uses: reactivecircus/android-emulator-runner@v2
continue-on-error: true
timeout-minutes: 25
with:
api-level: 28
arch: x86_64
profile: ${{ matrix.profile }}
script: cd ci && bundle exec fastlane run screengrab --verbose
- name: Upload Screenshots
uses: actions/upload-artifact@v2
with:
name: screenshots_android
path: |
ci/fastlane/metadata/android
# TODO - could also consider publishing to appetize or similar
# NOTE - would require building debug apk/ipa
# NOTE - could be called from another workflow via https://github.com/marketplace/actions/workflow-dispatch
# NOTE - could persist apk/ipa across workflows via https://jfrog.com/artifactory
# TODO - upload screenshots to relevant services
cleanup:
# NOTE - this will only run if previous action successful, so either ensure passes, or move to cron job
needs: [android_screenshot, ios_screenshot]
runs-on: ubuntu-latest
name: Delete intermediary artifacts
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: maths-club-app
failOnError: false