Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
name: Pull Request build check
name: Android CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'keyvalues/**'
- 'media/**'
- '.github/ISSUE_TEMPLATE/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checking out GameNative
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Inject credentials
run: |
cat <<EOF > local.properties
cat <<EOF >> gradle.properties
POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
SUPABASE_URL=${{ secrets.SUPABASE_URL }}
SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}
EOF

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run unit tests
run: ./gradlew :app:testDebugUnitTest

- name: Build Release APK
run: ./gradlew assembleRelease

- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk
98 changes: 14 additions & 84 deletions .github/workflows/app-release-signed.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Android CI
name: Android CI (Debug)

on:
push:
Expand All @@ -13,58 +13,32 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: set up Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Configure Keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
run: |
mkdir -p app/keystores
echo "$KEYSTORE" | base64 --decode > app/keystores/keystore
echo "storeFile=keystores/keystore" >> app/keystores/keystore.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> app/keystores/keystore.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> app/keystores/keystore.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> app/keystores/keystore.properties

- name: Configure Production Keystore
env:
PROD_KEYSTORE: ${{ secrets.PROD_KEYSTORE }}
PROD_KEYSTORE_KEY_ALIAS: ${{ secrets.PROD_KEYSTORE_KEY_ALIAS }}
PROD_KEYSTORE_KEY_PASSWORD: ${{ secrets.PROD_KEYSTORE_KEY_PASSWORD }}
PROD_KEYSTORE_STORE_PASSWORD: ${{ secrets.PROD_KEYSTORE_STORE_PASSWORD }}
run: |
mkdir -p app/keystores
echo "$PROD_KEYSTORE" | base64 --decode > app/keystores/prod.keystore
cat <<EOF > app/keystores/prod-keystore.properties
keyAlias=$PROD_KEYSTORE_KEY_ALIAS
keyPassword=$PROD_KEYSTORE_KEY_PASSWORD
storePassword=$PROD_KEYSTORE_STORE_PASSWORD
EOF

# REPLACED: Secrets are removed. Empty strings "" prevent the Java syntax error.
- name: Inject credentials
run: |
cat <<EOF > local.properties
POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
SUPABASE_URL=${{ secrets.SUPABASE_URL }}
SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}
POSTHOG_API_KEY=""
POSTHOG_HOST=""
SUPABASE_URL=""
SUPABASE_KEY=""
EOF

- name: Install Android SDK Build Tools
Expand All @@ -75,52 +49,15 @@ jobs:
fi
yes | "$SDKMANAGER" --install "build-tools;34.0.0"

# CHANGED: Switched to assembleDebug so we don't need signing keys
- name: Build with Gradle
run: ./gradlew :app:bundleRelease

- name: Extract APK from Bundle
run: |
java -jar tools/bundletool-all-1.17.2.jar build-apks --bundle=app/build/outputs/bundle/release/app-release.aab --output=app-release.apks --mode=universal
unzip -o app-release.apks universal.apk

- name: Copy lineage file
run: |
mkdir -p app/keystores
cp prod-debug.lineage app/keystores/prod-debug.lineage

- name: Dual sign universal APK
env:
DEBUG_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
DEBUG_KEY_PASS: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
DEBUG_STORE_PASS: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
PROD_ALIAS: ${{ secrets.PROD_KEYSTORE_KEY_ALIAS }}
PROD_KEY_PASS: ${{ secrets.PROD_KEYSTORE_KEY_PASSWORD }}
PROD_STORE_PASS: ${{ secrets.PROD_KEYSTORE_STORE_PASSWORD }}
run: |
BUILD_TOOLS_DIR="${ANDROID_HOME}/build-tools/34.0.0"
if [ ! -d "$BUILD_TOOLS_DIR" ]; then
BUILD_TOOLS_DIR="${ANDROID_SDK_ROOT}/build-tools/34.0.0"
fi
"${BUILD_TOOLS_DIR}/apksigner" sign \
--lineage app/keystores/prod-debug.lineage \
--ks app/keystores/keystore \
--ks-key-alias "$DEBUG_ALIAS" \
--ks-pass pass:$DEBUG_STORE_PASS \
--key-pass pass:$DEBUG_KEY_PASS \
--next-signer --ks app/keystores/prod.keystore \
--ks-key-alias "$PROD_ALIAS" \
--ks-pass pass:$PROD_STORE_PASS \
--key-pass pass:$PROD_KEY_PASS \
--out universal-signed.apk \
universal.apk
mv universal-signed.apk universal.apk
run: ./gradlew assembleDebug

- name: Upload Artifact
id: upload_app
uses: actions/upload-artifact@v4
with:
name: app-release-signed
path: ${{ github.workspace }}/universal.apk
name: app-debug
path: app/build/outputs/apk/debug/app-debug.apk

- name: Build changelog text
id: changelog
Expand All @@ -129,11 +66,4 @@ jobs:
echo 'log<<EOF' >>"$GITHUB_OUTPUT"
echo "$text" >>"$GITHUB_OUTPUT"
echo 'EOF' >>"$GITHUB_OUTPUT"

- name: Post to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
artifact_url="https://nightly.link/utkarshdalal/GameNative/actions/runs/${{ github.run_id }}/app-release-signed.zip"
payload='{"content":"**New Android build**\nDownload: '"$artifact_url"'\n\nChanges:\n'"${{ steps.changelog.outputs.log }}"'"}'
curl -H 'Content-Type: application/json' -d "$payload" "$DISCORD_WEBHOOK_URL"

149 changes: 0 additions & 149 deletions .github/workflows/tagged-release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
android:scheme="home" />
</intent-filter>
<intent-filter>
<action android:name="app.gamenative.LAUNCH_GAME" />
<action android:name="${applicationId}.LAUNCH_GAME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Expand Down
Loading
Loading