Files
lunasea/.github/workflows/publish_android.yml

122 lines
3.8 KiB
YAML

name: Publish Android
on:
workflow_call:
inputs:
build-changelog:
required: true
type: string
build-number:
required: true
type: string
build-title:
required: true
type: string
flavor:
required: true
type: string
secrets:
GOOGLE_PLAY_API:
required: true
S3_ACCESS_KEY:
required: true
S3_BUCKET:
required: true
S3_ENDPOINT:
required: true
S3_KEY_ID:
required: true
S3_REGION:
required: true
jobs:
play-store:
name: Play Store
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: play-store
google-play-key: ${{ secrets.GOOGLE_PLAY_API }}
- name: Download Play Store Package
uses: actions/download-artifact@v3
with:
name: android-playstore-package
path: ${{ github.workspace }}/output
- name: Determine Release Channel
id: channel
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.flavor }}
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: Generate Changelog
run: |
mkdir -p ${{ github.workspace }}/android/fastlane/metadata/android/en-CA/changelogs
echo ${{ inputs.build-changelog }} > ${{ github.workspace }}/android/fastlane/metadata/android/en-CA/changelogs/default.txt
- name: Deploy to Google Play Store
working-directory: ${{ github.workspace }}/android
env:
SUPPLY_JSON_KEY: ${{ github.workspace }}/keys/googleplay.json
run: bundle exec fastlane deploy_playstore track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/output/lunasea-android.aab version_name:${{ inputs.build-title }}
s3:
name: S3
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: s3
- name: Download Android App Package
uses: actions/download-artifact@v3
with:
name: android-app-package
path: ${{ github.workspace }}/output
- name: Upload to S3 Bucket (Build Title)
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl public-read --follow-symlinks
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
AWS_REGION: ${{ secrets.S3_REGION }}
SOURCE_DIR: ${{ github.workspace }}/output
DEST_DIR: ${{ inputs.build-title }}
- name: Create Version File
working-directory: ${{ github.workspace }}/output
run: echo ${{ inputs.build-number }} > VERSION_ANDROID.txt
- name: Upload to S3 Bucket (Latest)
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl public-read --follow-symlinks
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
AWS_REGION: ${{ secrets.S3_REGION }}
SOURCE_DIR: ${{ github.workspace }}/output
DEST_DIR: latest/${{ inputs.flavor }}