SchildiChat-android/.github/workflows/build.yml

74 lines
2.5 KiB
YAML

name: APK Build
on:
pull_request: { }
push:
branches: [ main, develop ]
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx2g
-Porg.gradle.parallel=false
CI_ANY_MAIN: ${{ github.ref == 'refs/heads/main' && format('main-{0}', github.sha) }}
CI_ANY_DEVELOP: ${{ github.ref == 'refs/heads/develop' && format('develop-{0}', github.sha) }}
CI_ONE_PR: ${{ format('build-debug-{0}-{1}', matrix.target, github.ref) }}
CI_GROUP_SUFFIX: ${{ CI_ANY_MAIN || CI_ANY_DEVELOP || CI_ONE_PR }}
jobs:
debug:
name: Build debug APKs (${{ matrix.target }})
runs-on: ubuntu-latest
concurrency:
group: ${{ format('build-debug-{0}-{1}', matrix.target, CI_GROUP_SUFFIX) }}
cancel-in-progress: true
if: github.ref != 'refs/heads/main'
strategy:
fail-fast: false
matrix:
target: [ Gplay, Fdroid ]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble ${{ matrix.target }} debug apk
run: ./gradlew assemble${{ matrix.target }}Debug $CI_GRADLE_ARG_PROPERTIES --stacktrace
- name: Upload ${{ matrix.target }} debug APKs
uses: actions/upload-artifact@v2
with:
name: vector-${{ matrix.target }}-debug
path: |
vector/build/outputs/apk/*/debug/*.apk
release:
name: Build unsigned GPlay APKs
runs-on: ubuntu-latest
concurrency:
group: ${{ format('build-release-{0}-{1}', matrix.target, CI_GROUP_SUFFIX) }}
cancel-in-progress: true
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble GPlay unsigned apk
run: ./gradlew clean assembleGplayRelease $CI_GRADLE_ARG_PROPERTIES --stacktrace
- name: Upload Gplay unsigned APKs
uses: actions/upload-artifact@v2
with:
name: vector-gplay-release-unsigned
path: |
vector/build/outputs/apk/*/release/*.apk
# TODO: add exodus checks