Docker build #285
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- flutter | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- flutter | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 1' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# native build on desktop | |
desktop: | |
strategy: | |
matrix: | |
include: | |
- host: linux | |
image: ubuntu-latest | |
runs-on: ${{ matrix.image }} | |
name: desktop/${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install doit | |
run: | | |
pip install doit | |
- name: Run dart analyzer | |
run: | | |
doit lint:dart | |
- name: Run tests | |
run: | | |
doit test | |
# build for android on different hosts | |
android: | |
strategy: | |
matrix: | |
include: | |
- host: linux | |
image: ubuntu-latest | |
- host: macos | |
image: macos-latest | |
- host: windows | |
image: windows-latest | |
runs-on: ${{ matrix.image }} | |
name: android/${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install doit | |
run: | | |
pip install doit | |
- name: Run dart analyzer | |
run: | | |
doit lint:dart | |
- name: Run spotless linter | |
run: | | |
doit lint:kotlin | |
- name: Build debug apk | |
run: | | |
doit build:apk variant=debug | |
- name: Build release apk | |
run: | | |
doit build:apk variant=release | |
# build for different targets on different hosts using docker | |
docker: | |
strategy: | |
matrix: | |
include: | |
- host: linux | |
target: android | |
image: ubuntu-latest | |
runs-on: ${{ matrix.image }} | |
name: docker/${{ matrix.target }}-${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
if: runner.os != 'Windows' | |
run: | | |
./script/docker_build.py | |
- name: Build (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
.\script\docker_build.bat | |
# build and publish github release | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [desktop, android, docker] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install doit | |
run: | | |
pip install doit | |
- name: Check manifests | |
run: | | |
./script/version_ctl.py check_release | |
- name: Build APK | |
env: | |
SIGNING_STORE_FILE: roc-droid.jks | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: | | |
echo "${{ secrets.SIGNING_STORE_BASE64 }}" | base64 -di > app/${{ env.SIGNING_STORE_FILE }} | |
doit build:apk variant=release | |
- name: Deploy APK | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: dist/android/release/roc-droid-*.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |