mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-14 16:57:21 +00:00
176 lines
6.3 KiB
YAML
176 lines
6.3 KiB
YAML
name: "Build: Android"
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
semver:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
KEYSTORE:
|
|
required: true
|
|
KEY_ALIAS:
|
|
required: true
|
|
KEY_PASS:
|
|
required: true
|
|
KEY_STORE_PASS:
|
|
required: true
|
|
push:
|
|
branches: [ "main" ]
|
|
paths: [ "android", "frontend" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
paths: [ "android", "frontend" ]
|
|
|
|
jobs:
|
|
build-android:
|
|
permissions: write-all
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 'Download Android Web.bundle Artifact (built frontend)'
|
|
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
|
|
uses: dawidd6/action-download-artifact@v11
|
|
with:
|
|
workflow: frontend-build.yml
|
|
workflow_conclusion: success
|
|
name: mobile-web.bundle
|
|
path: android/app/src/main/assets
|
|
|
|
- name: 'Download main.js Artifact for a release'
|
|
if: inputs.semver != '' # Only if fired as job in release.yml
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: mobile-web.bundle
|
|
path: android/app/src/main/assets
|
|
|
|
- name: Cache gradle
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Build APK
|
|
run: |
|
|
cd android
|
|
./gradlew assembleRelease --stacktrace
|
|
|
|
- name: 'Check for non-FOSS libraries'
|
|
run: |
|
|
wget https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar
|
|
wget https://github.com/iBotPeaches/Apktool/raw/master/scripts/linux/apktool
|
|
# clone the repo
|
|
git clone https://gitlab.com/IzzyOnDroid/repo.git
|
|
# create a directory for Apktool and move the apktool* files there
|
|
mkdir -p repo/lib/radar/tool
|
|
mv apktool* repo/lib/radar/tool
|
|
# create an alias for ease of use
|
|
chmod u+x repo/lib/radar/tool/apktool
|
|
mv repo/lib/radar/tool/apktool_2.7.0.jar repo/lib/radar/tool/apktool.jar
|
|
repo/bin/scanapk.php android/app/build/outputs/apk/release/app-universal-release-unsigned.apk
|
|
|
|
- name: Sign APK
|
|
uses: r0adkll/sign-android-release@v1
|
|
with:
|
|
releaseDirectory: android/app/build/outputs/apk/release
|
|
signingKeyBase64: ${{ secrets.KEYSTORE }}
|
|
alias: ${{ secrets.KEY_ALIAS }}
|
|
keyStorePassword: ${{ secrets.KEY_STORE_PASS }}
|
|
keyPassword: ${{ secrets.KEY_PASS }}
|
|
env:
|
|
BUILD_TOOLS_VERSION: "34.0.0"
|
|
|
|
- uses: kaisugi/action-regex-match@v1.0.1
|
|
id: regex-match
|
|
with:
|
|
text: ${{ github.ref }}
|
|
regex: '(v*-pre*)'
|
|
flags: gm
|
|
|
|
- name: 'Get Commit Hash'
|
|
id: commit
|
|
uses: pr-mpt/actions-commit-hash@v3
|
|
|
|
# Create app-universal-release APK artifact asset for Release
|
|
- name: 'Upload universal .apk Artifact'
|
|
if: inputs.semver != ''
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-universal-release.apk
|
|
path: android/app/build/outputs/apk/release/app-universal-release-unsigned-signed.apk
|
|
|
|
# Create app-arm64-v8a-release APK artifact asset for Release
|
|
- name: 'Upload arm64-v8a .apk Artifact'
|
|
if: inputs.semver != ''
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-arm64-v8a-release.apk
|
|
path: android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned-signed.apk
|
|
|
|
# Create app-armeabi-v7a-release APK artifact asset for Release
|
|
- name: 'Upload armeabi-v7a .apk Artifact'
|
|
if: inputs.semver != ''
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-armeabi-v7a-release.apk
|
|
path: android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned-signed.apk
|
|
|
|
# Create app-x86_64-release APK artifact asset for Release
|
|
- name: 'Upload x86_64 .apk Artifact'
|
|
if: inputs.semver != ''
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-x86_64-release.apk
|
|
path: android/app/build/outputs/apk/release/app-x86_64-release-unsigned-signed.apk
|
|
|
|
- name: Create Pre-Release
|
|
id: create_release
|
|
if: inputs.semver == '' # only if this workflow is not called from a Release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ github.ref }}
|
|
draft: true
|
|
|
|
- name: Upload APK Universal Asset
|
|
id: upload-release-asset-universal-apk
|
|
if: inputs.semver == '' # only if this workflow is not called from a Release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: android/app/build/outputs/apk/release/app-universal-release-unsigned-signed.apk
|
|
asset_name: robosats-${{ github.ref }}-universal.apk
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload APK arm64-v8a Asset
|
|
id: upload-release-asset-arm64-v8a
|
|
if: inputs.semver == '' # only if this workflow is not called from a Release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned-signed.apk
|
|
asset_name: robosats-${{ github.ref }}-arm64-v8a.apk
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload APK armeabi-v7a Asset
|
|
id: upload-release-asset-armeabi-v7a
|
|
if: inputs.semver == '' # only if this workflow is not called from a Release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned-signed.apk
|
|
asset_name: robosats-${{ github.ref }}-armeabi-v7a.apk
|
|
asset_content_type: application/zip
|