Skip to content

strato-android-build #5

strato-android-build

strato-android-build #5

name: strato-android-build
on:
workflow_dispatch:
inputs:
branch:
description: 'select branch to build(default: master)'
required: false
default: 'master'
flavor:
description: 'select flavor to build(default: mainline)'
required: false
default: 'mainline'
schedule:
- cron: "0 0 1 * *"
jobs:
strato_android_build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Download strato source code
run: |
cd ${{ github.workspace }}
git clone --branch ${{ github.event.inputs.branch || 'master' }} https://github.com/strato-emu/strato.git
cd strato
git config --global user.email "[email protected]"
git config --global user.name "impxada-autoci"
git config -f .gitmodules submodule.Sirit.url https://github.com/yuzu-mirror/sirit
git add .gitmodules
git commit -m "Update submodule URL"
git submodule update --init --recursive
- id: version
name: Get version
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
cd ${{ github.workspace }}/strato
echo "hash=$(git log -1 --pretty=format:%H)" >> $GITHUB_OUTPUT
echo "short_hash=$(git describe --always --long)" >> $GITHUB_OUTPUT
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Set up cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.ccache
key: ${{ runner.os }}-android-${{ steps.version.outputs.hash }}
restore-keys: |
${{ runner.os }}-android-
- name: Prepare environment
run: |
sudo apt-get install ccache glslang-dev glslang-tools
sudo apt-get install -y ninja-build
ln -s /usr/bin/ninja .
- name: Build Android
run: |
export NDK_CCACHE="$(which ccache)"
ccache -s
cd ${{ github.workspace }}/strato
chmod +x ./gradlew
./gradlew --no-daemon --stacktrace --build-cache --parallel --configure-on-demand assemble${{ github.event.inputs.flavor || 'mainline' }}Release
mv $(find app/build/outputs/apk -type f | grep -E "\.apk$") ${{ github.workspace }}/strato-${{ github.event.inputs.flavor || 'mainline' }}-${{ steps.version.outputs.date }}-${{ steps.version.outputs.version }}.apk
ccache -s
- name: Release Strato Android (Strato-Android)
uses: softprops/action-gh-release@v2
with:
name: Strato Android ${{ steps.version.outputs.date }}
tag_name: strato-android
files: ${{ github.workspace }}/strato-${{ github.event.inputs.flavor || 'mainline' }}-${{ steps.version.outputs.date }}-${{ steps.version.outputs.version }}.apk
- name: Release Strato Android ${{ steps.version.outputs.date }}
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.version.outputs.date }}
tag_name: ${{ steps.version.outputs.date }}
files: ${{ github.workspace }}/strato-${{ github.event.inputs.flavor || 'mainline' }}-${{ steps.version.outputs.date }}-${{ steps.version.outputs.version }}.apk