mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
148 lines
4.2 KiB
YAML
148 lines
4.2 KiB
YAML
name: '[Release] Android'
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build_flavor:
|
|
required: true
|
|
type: string
|
|
build_number:
|
|
required: true
|
|
type: string
|
|
|
|
secrets:
|
|
DISCORD_WEBHOOK:
|
|
required: true
|
|
FIREBASE_OPTIONS:
|
|
required: true
|
|
GOOGLE_PLAY_API:
|
|
required: true
|
|
KEY_JKS:
|
|
required: true
|
|
KEY_PROPERTIES:
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download Source Files
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: lib-${{ github.sha }}
|
|
path: ${{ github.workspace }}/lib
|
|
|
|
- name: Download Localization Files
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: localization-${{ github.sha }}
|
|
path: ${{ github.workspace }}/assets/localization
|
|
|
|
- name: Install Secrets
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart
|
|
echo ${{ secrets.KEY_JKS }} | base64 --decode > android/key.jks
|
|
echo ${{ secrets.KEY_PROPERTIES }} | base64 --decode > android/key.properties
|
|
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true
|
|
|
|
- name: Install Java
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: zulu
|
|
java-version: 11
|
|
|
|
- name: Install Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
cache: true
|
|
cache-key: ${{ github.sha }}
|
|
|
|
- name: Setup Flutter
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
flutter pub get
|
|
|
|
- name: Run Fastlane
|
|
working-directory: ${{ github.workspace }}/android
|
|
env:
|
|
SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json
|
|
run: |
|
|
bundle install
|
|
bundle exec fastlane build build_number:${{ inputs.build_number }}
|
|
|
|
- name: Upload App Bundle Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: android-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
path: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab
|
|
|
|
- name: Send Discord Message
|
|
uses: sarisia/actions-status-discord@v1
|
|
if: always()
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
with:
|
|
title: '`[${{ inputs.build_flavor }}]` Android Build'
|
|
description: android-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
needs: [ build ]
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Determine Release Channel
|
|
id: channel
|
|
uses: actions/github-script@v6
|
|
env:
|
|
FLAVOR: ${{ inputs.ref }}
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const ref = process.env.FLAVOR || "edge";
|
|
switch (ref) {
|
|
case "beta": return "alpha";
|
|
case "candidate": return "beta";
|
|
case "stable": return "production";
|
|
case "edge":
|
|
default: return "internal";
|
|
}
|
|
|
|
- name: Download App Package Artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: android-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
path: ${{ github.workspace }}
|
|
|
|
- name: Install Secret Keys
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
echo ${{ secrets.GOOGLE_PLAY_API }} | base64 --decode > .fastlane-android-auth.json
|
|
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true
|
|
|
|
- name: Deploy to Google Play Store
|
|
working-directory: ${{ github.workspace }}/android
|
|
env:
|
|
SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json
|
|
run: |
|
|
bundle install
|
|
bundle exec fastlane deploy track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }}
|