myPlanet release #263
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: myPlanet release | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
workflow_dispatch: | ||
jobs: | ||
create: | ||
name: create myPlanet release | ||
runs-on: ubuntu-latest | ||
env: | ||
ANDROID_NDK_VERSION: "21.3.6528147" | ||
BUILD_TOOLS_VERSION: "30.0.2" | ||
steps: | ||
- name: checkout repository code | ||
uses: actions/checkout@v4 | ||
- name: set more env | ||
run: echo "BRANCHNAME="${GITHUB_REF##*/} >> $GITHUB_ENV | ||
- name: expose version from build.gradle | ||
uses: dogi/[email protected] | ||
with: | ||
expose-version-name: 'true' | ||
expose-version-code: 'true' | ||
- name: setup JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
cache: 'gradle' | ||
- name: install NDK | ||
run: | | ||
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;${ANDROID_NDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT} | ||
chmod +x ./gradlew | ||
- name: build release APK and AAB | ||
run: | | ||
./gradlew assembleRelease bundleRelease | ||
ls -alR app/build/outputs | ||
mkdir -p sign | ||
cp app/build/outputs/bundle/release/app-release.aab sign/. | ||
cp app/build/outputs/apk/release/app-release-unsigned.apk sign/. | ||
- name: sign release APK and AAB | ||
uses: dogi/[email protected] | ||
with: | ||
releaseDirectory: sign | ||
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | ||
alias: ${{ secrets.ALIAS }} | ||
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | ||
keyPassword: ${{ secrets.KEY_PASSWORD }} | ||
- name: copy builds to output and generate sha256 | ||
run: | | ||
mkdir -p output | ||
cp sign/app-release-unsigned-signed.apk output/myPlanet.apk | ||
cp sign/app-release.aab output/myPlanet.aab | ||
sha256sum output/myPlanet.apk > output/myPlanet.apk.sha256 | ||
sha256sum output/myPlanet.aab > output/myPlanet.aab.sha256 | ||
ls -alR output | ||
onmaster: | ||
name: official myPlanet release | ||
Check failure on line 62 in .github/workflows/android-release.yml GitHub Actions / myPlanet releaseInvalid workflow file
|
||
if: github.ref == 'refs/heads/master' | ||
needs: create | ||
steps: | ||
- name: publish AAB to playstore | ||
uses: r0adkll/[email protected] | ||
with: | ||
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | ||
packageName: org.ole.planet.myplanet | ||
releaseFiles: output/myPlanet.aab | ||
track: internal | ||
releaseName: "${{ env.ANDROID_VERSION_CODE }} (${{ env.ANDROID_VERSION_NAME }})" | ||
status: completed | ||
- name: release APK and AAB on GitHub | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: output/* | ||
tag: v${{ env.ANDROID_VERSION_NAME }} | ||
overwrite: 'true' | ||
file_glob: 'true' | ||
onbranch: | ||
name: myPlanet test release | ||
if: github.ref != 'refs/heads/master' | ||
needs: create | ||
steps: | ||
- name: rename APK and AAB with version and branch for artifact | ||
run: | | ||
mv output/myPlanet.apk output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk | ||
mv output/myPlanet.apk.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk.sha256 | ||
mv output/myPlanet.aab output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab | ||
mv output/myPlanet.aab.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab.sha256 | ||
ls -alR output | ||
- name: upload APK and AAB as build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }} | ||
path: output/* | ||
retention-days: 9 |