mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 08:56:41 +00:00
133 lines
5.1 KiB
YAML
133 lines
5.1 KiB
YAML
name: Create android Play Store APK
|
|
on:
|
|
push:
|
|
branches: [master, release/*, test/git-actions]
|
|
tags:
|
|
- v*
|
|
workflow_dispatch:
|
|
inputs: {}
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-android:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }}
|
|
UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
node-version: 22
|
|
- name: Setup Java
|
|
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 21
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
|
|
# - name: Build with Gradle
|
|
# run: ./gradlew build
|
|
- name: Setup android-sdk
|
|
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
|
|
with:
|
|
accept-android-sdk-licenses: true
|
|
log-accepted-android-sdk-licenses: true #make accepting the android sdk license verbose
|
|
packages: 'platform-tools platforms;android-36 build-tools;35.0.0'
|
|
|
|
- name: Get npm cache directory
|
|
id: npm-cache-dir
|
|
run: |
|
|
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
|
|
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
|
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
|
|
with:
|
|
path: ${{ steps.npm-cache-dir.outputs.dir }}
|
|
key: ${{ runner.os }}-node22-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node22-
|
|
- name: Install npm Packages
|
|
# if: steps.npm-cache.outputs.cache-hit != 'true'
|
|
run: npm i
|
|
|
|
- name: Decode Keystore
|
|
env:
|
|
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.DROID_KEYSTORE_PASSWORD }}
|
|
RELEASE_KEYSTORE_ALIAS: ${{ secrets.DROID_KEYSTORE_ALIAS }}
|
|
RELEASE_KEY_PASSWORD: ${{ secrets.DROID_KEY_PASSWORD }}
|
|
run: |
|
|
echo "${{ secrets.DROID_KEYSTORE_BASE_64 }}" | base64 --decode > keystore.jks
|
|
|
|
- name: Build
|
|
run: npm run dist:android:prod
|
|
env:
|
|
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.DROID_KEYSTORE_PASSWORD }}
|
|
RELEASE_KEYSTORE_ALIAS: ${{ secrets.DROID_KEYSTORE_ALIAS }}
|
|
RELEASE_KEY_PASSWORD: ${{ secrets.DROID_KEY_PASSWORD }}
|
|
|
|
- name: DEBUG
|
|
run: |
|
|
ls -la android/app/build/outputs
|
|
ls -la android/app/build/outputs/apk
|
|
ls -la android/app/build/outputs/apk/play
|
|
ls -la android/app/build/outputs/apk/play/release
|
|
|
|
# APK is now signed automatically by Gradle using signingConfig
|
|
|
|
- name: 'Upload APK files'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: sup-android-release
|
|
path: android/app/build/outputs/apk/**/*.apk
|
|
|
|
- name: Wait for main release to be created
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
echo "Waiting for main release to be created..."
|
|
for i in {1..40}; do
|
|
if gh release view ${{ github.ref_name }} --repo ${{ github.repository }} >/dev/null 2>&1; then
|
|
echo "Release found!"
|
|
break
|
|
fi
|
|
echo "Waiting for release... (attempt $i/40)"
|
|
sleep 30
|
|
done
|
|
|
|
# Fail if release still doesn't exist
|
|
if ! gh release view ${{ github.ref_name }} --repo ${{ github.repository }} >/dev/null 2>&1; then
|
|
echo "ERROR: Release ${{ github.ref_name }} was not created after 20 minutes"
|
|
exit 1
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload APK to existing GitHub Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
for apk in android/app/build/outputs/apk/play/release/*.apk; do
|
|
if [ -f "$apk" ]; then
|
|
echo "Uploading $apk to release ${{ github.ref_name }}"
|
|
gh release upload ${{ github.ref_name }} "$apk" --repo ${{ github.repository }}
|
|
fi
|
|
done
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Prepare Google Play release notes
|
|
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')
|
|
run: npm run release-notes:prepare-play-store
|
|
|
|
- name: Upload to Google Play Console
|
|
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')
|
|
uses: r0adkll/upload-google-play@e738b9dd8f2476ea806d921b64aacd24f34515a5 # v1.1.5
|
|
with:
|
|
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
|
|
packageName: com.superproductivity.superproductivity
|
|
releaseFiles: android/app/build/outputs/apk/play/release/*.apk
|
|
tracks: internal
|
|
status: completed
|
|
inAppUpdatePriority: 2
|
|
whatsNewDirectory: build/generated-release-notes/play-store
|