ANDROID_KEYSTORE_PASSWORD was set in the CI runner environment but never forwarded into the Dagger container, so System.getenv() returned null inside the Flutter build, causing a NullPointerException in FinalizeBundleTask when signing the release bundle. - Add keystorePassword *dagger.Secret param to BuildAndroidRelease, BuildAndroidApk, PublishAndroid, and DeployApk in the Dagger module - Pass ANDROID_KEYSTORE_PASSWORD via WithSecretVariable to the build container - Update ci.yml to supply env:ANDROID_KEYSTORE_PASSWORD to both publish-android and deploy-apk dagger calls - Refactor build.gradle.kts to conditionally create the signing config only when both the keystore file and password are available, avoiding null values being passed to the signing config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
140 lines
5.0 KiB
YAML
140 lines
5.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
check:
|
|
name: Full Project Check
|
|
runs-on: self-hosted
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 50
|
|
|
|
- name: Enable Nix flakes
|
|
run: |
|
|
mkdir -p ~/.config/nix
|
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
|
|
|
- name: Run Full Check Suite
|
|
run: nix develop --no-warn-dirty --command dagger call --progress=plain -m ci check --source .
|
|
|
|
build-linux:
|
|
name: Build Linux Release
|
|
runs-on: self-hosted
|
|
needs: check
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 50
|
|
|
|
- name: Enable Nix flakes
|
|
run: |
|
|
mkdir -p ~/.config/nix
|
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
|
|
|
- name: Build & Deploy Linux to server
|
|
continue-on-error: true
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
run: |
|
|
HASH=$(git rev-parse --short HEAD)
|
|
nix develop --no-warn-dirty --command dagger call --progress=plain -m ci deploy-linux --source . --ssh-key env:SSH_PRIVATE_KEY --ssh-user "$SSH_USER" --ssh-host "$SSH_HOST" --commit-hash "$HASH"
|
|
|
|
deploy-playstore:
|
|
name: Build & Deploy to Play Store
|
|
runs-on: self-hosted
|
|
needs: check
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 50
|
|
|
|
- name: Enable Nix flakes
|
|
run: |
|
|
mkdir -p ~/.config/nix
|
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
|
|
|
- name: Install Android SDK (cached on runner between runs)
|
|
run: |
|
|
SDK="${ANDROID_HOME:-$HOME/Android/Sdk}"
|
|
if [ ! -d "$SDK/platforms/android-34" ]; then
|
|
echo "Android SDK not found, installing..."
|
|
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdtools.zip
|
|
mkdir -p "$SDK/cmdline-tools"
|
|
unzip -q /tmp/cmdtools.zip -d "$SDK/cmdline-tools"
|
|
[ -d "$SDK/cmdline-tools/cmdline-tools" ] && mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
|
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null 2>&1 || true
|
|
"$SDK/cmdline-tools/latest/bin/sdkmanager" "platform-tools" "build-tools;34.0.0" "platforms;android-34"
|
|
else
|
|
echo "Android SDK cached, skipping install."
|
|
fi
|
|
|
|
- name: Prepare Keystore
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
run: |
|
|
if [ -n "$ANDROID_KEYSTORE_BASE64" ]; then
|
|
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/upload-keystore.jks
|
|
else
|
|
echo "Error: ANDROID_KEYSTORE_BASE64 secret is not set."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build & Deploy to Play Store
|
|
env:
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
|
|
run: |
|
|
nix develop --no-warn-dirty --command dagger call --progress=plain -m ci publish-android --source . --play-store-config env:PLAY_STORE_CONFIG_JSON --keystore-password env:ANDROID_KEYSTORE_PASSWORD
|
|
|
|
- name: Build & Deploy APK to server
|
|
continue-on-error: true
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
run: |
|
|
HASH=$(git rev-parse --short HEAD)
|
|
nix develop --no-warn-dirty --command dagger call --progress=plain -m ci deploy-apk --source . --ssh-key env:SSH_PRIVATE_KEY --ssh-user "$SSH_USER" --ssh-host "$SSH_HOST" --commit-hash "$HASH" --keystore-password env:ANDROID_KEYSTORE_PASSWORD
|
|
|
|
publish-website:
|
|
name: Publish Website Build History
|
|
runs-on: self-hosted
|
|
needs: [build-linux, deploy-playstore]
|
|
if: |
|
|
always() &&
|
|
github.ref == 'refs/heads/main' &&
|
|
(needs.build-linux.result == 'success' || needs.deploy-playstore.result == 'success')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Enable Nix flakes
|
|
run: |
|
|
mkdir -p ~/.config/nix
|
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
|
|
|
- name: Generate build history and deploy website
|
|
continue-on-error: true
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
run: |
|
|
nix develop --no-warn-dirty --command dagger call --progress=plain -m ci publish-website --source . --ssh-key env:SSH_PRIVATE_KEY --ssh-user "$SSH_USER" --ssh-host "$SSH_HOST"
|