added support for caching generated apks #37
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: App Dev Builds | |
on: | |
push: | |
branches: [ "nt/gh-actions" ] | |
jobs: | |
ios-build: | |
name: iOS Dev Build | |
runs-on: macos-latest | |
environment: Android Dev | |
steps: | |
- name: Show host machine infomation | |
run: uname -a | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: Checkout repo from dev branch | |
uses: actions/checkout@v3 | |
with: | |
ref: nt/gh-actions | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0.0' | |
- name: Setup Cocoapods | |
uses: maxim-lobanov/setup-cocoapods@v1 | |
with: | |
version: 1.15.2 | |
- name: Create Google Services PLIST File | |
env: | |
GOOGLE_JSON: ${{ secrets.GOOGLE_PLIST }} | |
run: echo $GOOGLE_PLIST | base64 --decode > ./ios/GoogleService-Info.plist | |
# - name: Cache cocoapods | |
# uses: actions/cache@v3 | |
# with: | |
# path: /ios/Pods | |
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pods- | |
- name: Install npm dependency | |
run: yarn install | |
- name: Build iOS JS Bundle | |
run: | | |
yarn run package-ios | |
- name: Install bundler | |
run: | | |
cd ios | |
gem install bundler | |
- name: Install gem plugins | |
run: | | |
cd ios | |
bundle install | |
- name: Run fastlane | |
run: | | |
cd ios | |
bundle exec fastlane build_testflight | |
android-build: | |
name: Android Dev Build | |
runs-on: macos-latest | |
environment: Android Dev | |
steps: | |
- name: Show host machine infomation | |
run: uname -a | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: Checkout repo from dev branch | |
uses: actions/checkout@v3 | |
with: | |
ref: nt/gh-actions | |
- name: Install npm dependency | |
run: yarn install | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
cmdline-tools-version: 11479570 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Create Google Services JSON File | |
env: | |
GOOGLE_JSON: ${{ secrets.GOOGLE_JSON }} | |
run: echo $GOOGLE_JSON | base64 --decode > ./android/app/google-services.json | |
- name: Execute Gradle build | |
run: | | |
cd android | |
./gradlew assembleRelease | |
- name: Cache generated APK | |
uses: actions/cache@v3 | |
with: | |
path: app/build/outputs/apk/ | |
key: apk-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
apk-${{ runner.os }}- | |
- name: Upload application | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app | |
path: ./android/app/build/outputs/apk/release/app-release-unsigned.apk | |
# - name: Build Android JS Bundle | |
# run: | | |
# yarn run package-android | |
# - name: Delete Android build duplicate assets resource | |
# run: yarn run delete-pics | |
# - name: Install bundler | |
# run: | | |
# cd android | |
# gem install bundler | |
# - name: Install gem plugins | |
# run: | | |
# cd android | |
# bundle install | |
# - name: Run fastlane | |
# run: | | |
# cd android | |
# bundle exec fastlane build_qa |