Build Android project #30
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: Build Android project | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
type: choice | |
description: Deploy to Play Store or Firebase | |
options: | |
- play-store | |
- firebase | |
version: | |
type: string | |
required: true | |
description: "Version name" | |
env: | |
KEYSTORE_PATH: "${{ github.workspace }}/keystore.jks" | |
FIREBASE_CREDENTIALS_PATH: "${{ github.workspace }}/firebase.json" | |
jobs: | |
build: | |
name: Build project | |
runs-on: macos-14 | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@v3 | |
- name: "Setup dependencies: Node" | |
uses: actions/setup-node@v4 | |
- name: "Install dependencies" | |
uses: Macro-Deck-App/Actions/setup-ionic@main | |
- name: "Build Ionic app" | |
run: ionic build -c production | |
- name: "Sync Android project" | |
run: cap sync android | |
- name: "Save signing keystore" | |
run: base64 -d <<< "${{secrets.ANDROID_KEYSTORE_BASE64}}" > $KEYSTORE_PATH | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: "Cache bundles" | |
uses: actions/cache@v3 | |
with: | |
key: "android-bundle-${{ hashFiles('android/Gemfile') }}" | |
path: android/App/vendor/bundle | |
- name: "Build project" | |
env: | |
VERSION_NUMBER: ${{ inputs.version }} | |
KEYSTORE_FILE_PATH: ${{env.KEYSTORE_PATH}} | |
KEYSTORE_FILE_PASSWORD: ${{secrets.ANDROID_KEYSTORE_PASSWORD}} | |
KEYSTORE_FILE_ALIAS: ${{secrets.ANDROID_KEYSTORE_KEY}} | |
run: | | |
export BUILD_NUMBER=$(( ${{ github.run_number }} + 300 )) | |
cd android | |
which bundle || gem install bundler | |
bundle config path vendor/bundle | |
bundle install | |
bundle exec fastlane build | |
- name: "Upload to Firebase" | |
if: ${{ github.event.inputs.type == 'firebase' }} | |
env: | |
FIREBASE_APP_ID: ${{secrets.FIREBASE_APP_ID}} | |
run: | | |
base64 -d <<< "${{secrets.FASTLANE_CERTIFICATES_KEY}}" > $FIREBASE_CREDENTIALS_PATH | |
cd android | |
bundle exec fastlane beta | |
- name: "Upload to Play Store" | |
if: ${{ github.event.inputs.type == 'play-store' }} | |
env: | |
PLAYSTORE_CREDENTIALS: ${{secrets.PLAYSTORE_CREDENTIALS}} | |
run: | | |
cd android | |
bundle exec fastlane release |