Add New APK Only Pipeline

- Automatically sync downstream if build succeeds on a commit to master
- Downstream build APK only and publish as a release
- Use deterministic name for programmatic access
This commit is contained in:
Jonathan Steffan
2024-08-18 23:52:21 +02:00
committed by xytovl
parent 3d4690cb0c
commit 8ef136ed5c
4 changed files with 163 additions and 2 deletions
+129
View File
@@ -0,0 +1,129 @@
name: Release APK Only
on:
push:
branches: [ "master" ]
env:
BUILD_TYPE: RelWithDebInfo
jobs:
build-android-only:
name: Android
runs-on: ubuntu-22.04
if: ${{ vars.APK_ONLY != '' }}
strategy:
matrix:
hmd: ['Standard']
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Install dependencies
run: >
sudo apt-get update && sudo apt-get install glslang-tools librsvg2-bin gettext
- name: Check for Secret availability
id: secret-check
shell: bash
run: |
if [[ "${{ secrets.APK_SIGNINGKEYPASSWORD }}" != '' && "${{ secrets.APK_KEYSTORE_BASE64 }}" != '' ]]; then
echo "available=true" >> $GITHUB_OUTPUT;
else
echo "available=false" >> $GITHUB_OUTPUT;
fi
- name: Secrets
if: ${{ github.event_name != 'pull_request' && steps.secret-check.outputs.available == 'true' }}
env:
APK_SIGNINGKEYPASSWORD: ${{ secrets.APK_SIGNINGKEYPASSWORD }}
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
run: |
echo signingKeyPassword="$APK_SIGNINGKEYPASSWORD" > gradle.properties
echo "$APK_KEYSTORE_BASE64" | base64 --decode --ignore-garbage > ks.keystore
- name: Build
run: |
chmod +x gradlew
./gradlew assemble${{ matrix.hmd }}${{ matrix.buildtype }}
- name: Prepare before archiving artifacts
run: |
mkdir apk
mv $(find build/outputs/apk/ -name "*.apk") apk/
mkdir debug
mv build/intermediates/merged_native_libs/*/out/lib/* debug/
find debug -name libopenxr_loader.so -delete
- name: Archive APK
uses: actions/upload-artifact@v4
with:
name: apk-${{ matrix.hmd }}-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
path: apk/*.apk
retention-days: 7
- name: Archive debug symbols
if: ${{ matrix.buildtype != 'Release' }}
uses: actions/upload-artifact@v4
with:
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
path: debug/**/*.so
retention-days: 7
release:
name: Create APK release
runs-on: ubuntu-latest
needs: build-android-only
if: ${{ vars.APK_ONLY != '' }}
steps:
- name: Download APK artifacts
uses: actions/download-artifact@v4
with:
path: apk
pattern: 'apk-*'
merge-multiple: true
- name: Rename APK artifacts
run: |
cd apk
for f in *.apk; do
BASENAME=`echo ${f}|awk -F '-apk-' '{print $2}'`
mv "${f}" "org.meumeu.wivrn-${BASENAME}"
done
- name: Download APK debug artifacts
uses: actions/download-artifact@v4
with:
path: symbols
pattern: 'symbols-*'
merge-multiple: false
- name: Zip APK debug artifacts
run: |
cd symbols
zip -r ../debug-symbols.zip .
- name: APK Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}
tag_name: "apk-${{ github.sha }}"
generate_release_notes: true
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
apk/*.apk
debug-symbols.zip
+32 -2
View File
@@ -16,6 +16,7 @@ jobs:
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
if: ${{ vars.APK_ONLY == '' }}
steps:
- uses: actions/checkout@v4
@@ -77,6 +78,7 @@ jobs:
build-server-flatpak:
name: Linux server (flatpak)
runs-on: ubuntu-latest
if: ${{ vars.APK_ONLY == '' }}
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
@@ -102,6 +104,7 @@ jobs:
build-test-client:
name: Linux client
runs-on: ubuntu-22.04
if: ${{ vars.APK_ONLY == '' }}
steps:
- uses: actions/checkout@v4
@@ -135,6 +138,7 @@ jobs:
build-dissector:
name: Wireshark dissector
runs-on: ubuntu-22.04
if: ${{ vars.APK_ONLY == '' }}
steps:
- uses: actions/checkout@v4
@@ -169,6 +173,7 @@ jobs:
build-android:
name: Android
runs-on: ubuntu-22.04
if: ${{ vars.APK_ONLY == '' }}
strategy:
matrix:
@@ -228,6 +233,7 @@ jobs:
with:
name: apk-${{ matrix.hmd }}-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
path: apk/*.apk
retention-days: 30
- name: Archive debug symbols
if: ${{ matrix.buildtype != 'Release' }}
@@ -235,12 +241,13 @@ jobs:
with:
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
path: debug/**/*.so
retention-days: 30
release:
name: Create release
runs-on: ubuntu-22.04
needs: [build-server, build-android, build-test-client, build-dissector, build-server-flatpak]
if: success() && startsWith(github.ref, 'refs/tags/')
needs: [build-android, build-server-flatpak]
steps:
- name: Download artifacts (APK)
@@ -257,7 +264,7 @@ jobs:
path: flatpak
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.ref }}
generate_release_notes: true
@@ -265,3 +272,26 @@ jobs:
files: |
apk/*.apk
flatpak/*.flatpak
sync_fork_downstream:
name: Sync fork downstream
runs-on: ubuntu-latest
needs: [build-server, build-android]
if: ${{ vars.APK_ONLY == '' }} && github.branch == 'master'
steps:
- name: Check for DOWNSTREAM_GITHUB_TOKEN
id: downstream-secret-check
shell: bash
run: |
if [[ "${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}" != '' ]]; then
echo "available=true" >> $GITHUB_OUTPUT;
else
echo "available=false" >> $GITHUB_OUTPUT;
fi
- name: Sync fork downstream
if: ${{ steps.downstream-secret-check.outputs.available == 'true' }}
run: |
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}" \
https://api.github.com/repos/WiVRn/WiVRn-APK/merge-upstream \
-d '{"branch":"master"}'
+1
View File
@@ -4,6 +4,7 @@ jobs:
formatting-check:
name: Formatting check
runs-on: ubuntu-latest
if: ${{ vars.APK_ONLY == '' }}
strategy:
fail-fast: false
matrix:
+1
View File
@@ -4,6 +4,7 @@ jobs:
locale-check:
name: Locale check
runs-on: ubuntu-latest
if: ${{ vars.APK_ONLY == '' }}
steps:
- uses: actions/checkout@v4