mirror of
https://github.com/thelinkin3000/SonicLair.git
synced 2026-01-18 20:18:34 -05:00
* Removed targetDropDown file from Android Studio * Changed the pipeline to bundle a release and upload it as artifact instead of the apk for Play Store publishing
89 lines
2.9 KiB
YAML
89 lines
2.9 KiB
YAML
name: Build Android
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
permissions: write-all
|
|
name: Build APK
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get tag
|
|
id: tag
|
|
uses: dawidd6/action-get-tag@v1
|
|
|
|
- name: Checkout source
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup java
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '11'
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 16.x
|
|
|
|
- name: Install app dependencies
|
|
run: npm install --legacy-peer-deps
|
|
|
|
- name: Build Frontend
|
|
run: npm run build
|
|
|
|
- name: Capacitor sync
|
|
run: npx cap sync android
|
|
|
|
- name: Decode Keystore
|
|
id: decode_keystore
|
|
uses: timheuer/base64-to-file@v1
|
|
with:
|
|
fileName: 'android/app/releasekey.jks'
|
|
encodedString: ${{ secrets.KEYSTORE }}
|
|
|
|
- name: Run linter on Android code (Only mine, not capacitor nor cordova)
|
|
run: cd android && gradle :app:lintRelease
|
|
|
|
- name: Build app apk (already signed)
|
|
run: cd android && gradle assembleRelease
|
|
|
|
- name: Bundle release for Play Store
|
|
run: cd android && gradle bundleRelease
|
|
|
|
- name: Rename apk
|
|
run: mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/SonicLair-${{steps.tag.outputs.tag}}.apk
|
|
|
|
- name: Rename aab
|
|
run: mv android/app/build/outputs/bundle/release/app-release.aab android/app/build/outputs/bundle/release/SonicLair-${{steps.tag.outputs.tag}}.aab
|
|
|
|
- name: Upload release bundle as artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
path: android/app/build/outputs/bundle/release/SonicLair-${{steps.tag.outputs.tag}}.aab
|
|
retention-days: 60
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by github
|
|
with:
|
|
tag_name: ${{steps.tag.outputs.tag}}
|
|
release_name: Release ${{steps.tag.outputs.tag}}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
|
asset_path: android/app/build/outputs/apk/release/SonicLair-${{steps.tag.outputs.tag}}.apk
|
|
asset_name: SonicLair ${{steps.tag.outputs.tag}}.apk
|
|
asset_content_type: application/vnd.android.package-archive |