Files
SheetHappens/.github/workflows/build-android.yml
T
billisdead 8f42971187
Release APK / build (push) Has been cancelled
ci: switch to signed release APK via build-apk.sh
Debug APK required Metro bundler at runtime. Switch to a signed release
build using a local keystore (same pattern as Postiz-Android): keystore
decoded from KEYSTORE_B64 secret, build-apk.sh patches build.gradle and
assembles a standalone APK.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 18:07:22 +02:00

123 lines
3.7 KiB
YAML

name: Release APK
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
concurrency:
group: build-android-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.server_url == 'https://github.com'
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/share/boost /opt/ghc
sudo rm -rf /usr/local/share/chromium /usr/local/share/powershell
sudo rm -rf /usr/share/swift /usr/local/julia*
sudo apt-get autoremove -y > /dev/null 2>&1
sudo apt-get clean
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Accept Android SDK licenses
run: yes | sdkmanager --licenses || true
- name: Install SDK components
run: |
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decode keystore
run: |
mkdir -p ~/.config/sheethappens
echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > ~/.config/sheethappens/sheethappens.jks
cat > ~/.config/sheethappens/signing.env <<EOF
KEYSTORE_PATH=~/.config/sheethappens/sheethappens.jks
KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}
KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}
EOF
chmod 600 ~/.config/sheethappens/signing.env ~/.config/sheethappens/sheethappens.jks
- name: Build signed APK
run: ./build-apk.sh
- name: Find built APK
id: apk
run: |
APK=$(ls dist/*.apk | sort | tail -1)
echo "path=$APK" >> "$GITHUB_OUTPUT"
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${{ github.ref_name }}$" | head -1)
echo "Previous tag: $PREV_TAG"
FEATS=$(git log "${PREV_TAG}..HEAD" --pretty=format:"%s" --no-merges \
| grep -E "^feat(\([^)]+\))?: " \
| sed -E 's/^feat(\([^)]+\))?: //' \
| sed 's/^/- /')
FIXES=$(git log "${PREV_TAG}..HEAD" --pretty=format:"%s" --no-merges \
| grep -E "^fix(\([^)]+\))?: " \
| sed -E 's/^fix(\([^)]+\))?: //' \
| sed 's/^/- /')
{
echo "changelog<<CEOF"
[ -n "$FEATS" ] && printf "### What's New\n%s\n\n" "$FEATS"
[ -n "$FIXES" ] && printf "### Bug Fixes\n%s\n\n" "$FIXES"
echo "CEOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "SheetHappens ${{ github.ref_name }}"
body: |
## SheetHappens ${{ github.ref_name }}
${{ steps.changelog.outputs.changelog }}
### Installation
1. Enable "Unknown sources" on the device
2. Transfer the APK to the device and open it to install
files: ${{ steps.apk.outputs.path }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}