Wholphin/.github/workflows/main.yml
Ray 31465051ff
Dev: use build product flavors for app store release (#1205)
## Description
Instead of applying a code patch, this PR uses build time [product
flavors](https://developer.android.com/build/build-variants#product-flavors)
to define the existing default and an app store variant. This is more
robust than maintaining a patch file and making sure it is applied
before building.

The app store variant applies the same code changes (removing install
permission, requiring leanback, & setting `UpdateChecker.ACTIVE`), but
via manifest placeholders/merging and `BuildConfig` entries.

There are no user facing changes.

### Related issues
None

### Testing
Built the variants and verified manifest changes via aapt

## Screenshots
N/A

## AI or LLM usage
None
2026-04-06 15:24:20 -04:00

100 lines
3.8 KiB
YAML

name: Development build
on:
push:
branches:
- main
- develop/*
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BRANCH_NAME: ${{ github.ref_name }}
GRADLE_OPTS: "-Dorg.gradle.jvmargs='-Xmx4g -XX:MaxMetaspaceSize=512m'"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout the code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Need the tags to build
- name: Setup
uses: ./.github/actions/setup
- name: Get version names
run: |
LATEST_TAG=$(git describe --tags --match 'v*' --abbrev=0)
VERSION_NAME=$(git describe --tags --match 'v*' --long)
if [[ $BRANCH_NAME == "main" ]]; then
TAG_NAME="develop"
else
TAG_NAME="${BRANCH_NAME/\//-}"
fi
echo "LATEST_TAG=$LATEST_TAG" >> "$GITHUB_ENV"
echo "VERSION_NAME=$VERSION_NAME" >> "$GITHUB_ENV"
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
- name: Build release app
id: build
env:
KEY_ALIAS: "${{ secrets.KEY_ALIAS }}"
KEY_PASSWORD: "${{ secrets.KEY_PASSWORD }}"
KEY_STORE_PASSWORD: "${{ secrets.KEY_STORE_PASSWORD }}"
SIGNING_KEY: "${{ secrets.SIGNING_KEY }}"
ORG_GRADLE_PROJECT_WholphinExtensionsUsername: "${{ secrets.EXTENSIONS_USERNAME }}"
ORG_GRADLE_PROJECT_WholphinExtensionsPassword: "${{ secrets.EXTENSIONS_PASSWORD }}"
run: |
./gradlew clean assembleDefaultRelease assembleDefaultDebug --no-daemon
- name: Verify signatures
run: |
echo "Verify APK signatures"
find app/build/outputs/apk -name '*.apk'
find app/build/outputs/apk -name '*.apk' -print0 | xargs -t -0 -n1 ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs
- name: Copy APK to shorter names
id: apks
run: |
find app/build/outputs/apk -name '*.apk' -print0 |
while IFS= read -r -d '' line; do
# Wholphin-release-0.2.9-62-g5c12e03-16-arm64-v8a.apk => Wholphin-arm64-v8a.apk
short_name="$(echo $line | sed -E 's/-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g[a-fA-F0-9]+-[0-9]+//' | sed -E 's/-default//')"
echo "$line => $short_name"
cp "$line" "$short_name"
done
apks=$(find app/build/outputs/apk -name '*.apk' -print0 | tr '\0' ',' | sed 's/,$//')
echo "apks=$apks" >> "$GITHUB_OUTPUT"
- name: Checksums
run: |
echo "SHA256 checksums:"
find app/build/outputs/apk -name '*.apk' -print0 | xargs -0 sha256sum
- name: Delete ${{ env.TAG_NAME }} tag and release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete "${{ env.TAG_NAME }}" --cleanup-tag -y || true
echo '### `${{ env.BRANCH_NAME }}` development build
This pre-release tracks the development build of Wholphin from the `${{ env.BRANCH_NAME }}` unstable branch.
See https://github.com/damontecres/Wholphin/releases/latest for the latest stable release.
If you want to update to this version in-app, change Settings->Advanced->Update URL to https://api.github.com/repos/damontecres/Wholphin/releases/tags/${{ env.TAG_NAME }} (replace `latest` with `tags/${{ env.TAG_NAME }}`).
[See changes since `${{ env.LATEST_TAG }}`](https://github.com/damontecres/Wholphin/compare/${{ env.LATEST_TAG }}...${{ env.TAG_NAME }})' > ci_release_note.txt
gh release create "${{ env.TAG_NAME }}" \
--latest=false --prerelease --title "${{ env.VERSION_NAME }}" --target "${{ env.BRANCH_NAME }}" -F ci_release_note.txt \
"app/build/outputs/apk/**/*.apk"