148 lines
6.3 KiB
YAML
148 lines
6.3 KiB
YAML
name: Release CI
|
|
|
|
on: workflow_dispatch
|
|
|
|
jobs:
|
|
build_nomaps:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
versionCode: ${{ steps.versioncode.outputs.versionCode }}
|
|
versionName: ${{ steps.versionname.outputs.versionName }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Get versionCode
|
|
id: versioncode
|
|
run: echo "versionCode=$(grep 'versionCode' app/build.gradle.kts | awk '{ print $3 }' | head -n 1)" >> $GITHUB_OUTPUT
|
|
- name: Get versionName
|
|
id: versionname
|
|
run: echo "versionName=$(grep 'versionName' app/build.gradle.kts | head -1 | awk -F\" '{ print $2 }')" >> $GITHUB_OUTPUT
|
|
- name: Strip internet permission
|
|
run: chmod +x ./strip_permission.sh && ./strip_permission.sh
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'adopt'
|
|
cache: 'gradle'
|
|
java-version: 17
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
- name: Setup Gradle
|
|
uses: gradle/gradle-build-action@v3
|
|
- name: Make Gradle executable
|
|
run: chmod +x ./gradlew
|
|
- name: Decode Keystore
|
|
id: decode_keystore
|
|
uses: timheuer/base64-to-file@v1
|
|
with:
|
|
fileName: 'release_key.jks'
|
|
fileDir: 'app/'
|
|
encodedString: ${{ secrets.SIGNING_KEY }}
|
|
- name: Build Release APK
|
|
run: ./gradlew assembleRelease
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Gallery Release (No Maps)
|
|
path: app/build/**/*.apk
|
|
|
|
build_maps:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
versionCode: ${{ steps.versioncode.outputs.versionCode }}
|
|
versionName: ${{ steps.versionname.outputs.versionName }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Get versionCode
|
|
id: versioncode
|
|
run: echo "versionCode=$(grep 'versionCode' app/build.gradle.kts | awk '{ print $3 }' | head -n 1)" >> $GITHUB_OUTPUT
|
|
- name: Get versionName
|
|
id: versionname
|
|
run: echo "versionName=$(grep 'versionName' app/build.gradle.kts | head -1 | awk -F\" '{ print $2 }')" >> $GITHUB_OUTPUT
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'adopt'
|
|
cache: 'gradle'
|
|
java-version: 17
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
- name: Setup Gradle
|
|
uses: gradle/gradle-build-action@v3
|
|
- name: Make Gradle executable
|
|
run: chmod +x ./gradlew
|
|
- name: Load Maps Token
|
|
env:
|
|
MAPS_TOKEN: $
|
|
run: echo MAPS_TOKEN=\"$MAPS_TOKEN\" > ./api.properties
|
|
- name: Decode Keystore
|
|
id: decode_keystore
|
|
uses: timheuer/base64-to-file@v1
|
|
with:
|
|
fileName: 'release_key.jks'
|
|
fileDir: 'app/'
|
|
encodedString: ${{ secrets.SIGNING_KEY }}
|
|
- name: Build Release APK
|
|
run: ./gradlew assembleRelease
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Gallery Release (Maps)
|
|
path: app/build/**/*.apk
|
|
- name: Apply Google Play patch
|
|
id: gplay_patcher
|
|
run: git config --global user.email "paulionut2003@gmail.com" &&
|
|
git config --global user.name "IacobIonut01" &&
|
|
git fetch https://github.com/IacobIonut01/Gallery.git main_play &&
|
|
git cherry-pick e63cd751baa1dc733222d5a3ce135cb7bc52868b &&
|
|
chmod +x ./strip_allfiles_permission.sh && ./strip_allfiles_permission.sh &&
|
|
echo ALL_FILES_ACCESS=false > ./app.properties
|
|
- name: Build Google Play Bundle
|
|
run: ./gradlew bundleUniversalGplay
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
|
- uses: r0adkll/upload-google-play@v1
|
|
continue-on-error: true
|
|
with:
|
|
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
|
|
packageName: com.dot.gallery.gplay
|
|
releaseFiles: app/build/outputs/bundle/universalGplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-universal-gplay.aab
|
|
track: production
|
|
releaseName: ${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }} Release
|
|
mappingFile: app/build/outputs/mapping/universalGplay/mapping.txt
|
|
debugSymbols: app/build/intermediates/merged_native_libs/universalGplay/mergeUniversalGplayNativeLibs/out/lib
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Gallery Release (GPlay Bundle)
|
|
path: app/build/outputs/bundle/universalGplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-universal-gplay.aab
|
|
|
|
release:
|
|
needs: [build_nomaps, build_maps]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: Gallery Release (No Maps)
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: Gallery Release (Maps)
|
|
- name: Generate SHA256
|
|
run: echo "### Checksums" >> ${{ needs.build_maps.outputs.versionName }}-${{ needs.build_maps.outputs.versionCode }}-changelog.txt && find . -name "Gallery-*.apk" -type f -print0 | sort -z | xargs -r0 sha256sum | awk '{gsub(".*/", "", $2); print "**"$2"**:", "`"$1"`"} ' >> ${{ needs.build_maps.outputs.versionName }}-${{ needs.build_maps.outputs.versionCode }}-changelog.txt
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ needs.build_maps.outputs.versionName }}-${{ needs.build_maps.outputs.versionCode }} Release
|
|
body_path: ${{ needs.build_maps.outputs.versionName }}-${{ needs.build_maps.outputs.versionCode }}-changelog.txt
|
|
prerelease: false
|
|
tag_name: ${{ needs.build_maps.outputs.versionName }}-${{ needs.build_maps.outputs.versionCode }}
|
|
files: |
|
|
./**/Gallery-*.apk
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|