diff --git a/.github/workflows/publish_android.yml b/.github/workflows/publish_android.yml new file mode 100644 index 0000000..d1c78dd --- /dev/null +++ b/.github/workflows/publish_android.yml @@ -0,0 +1,108 @@ +name: Build android distribution +on: + workflow_dispatch: + inputs: + version_number: + description: 'The version to release. A matching tag prefixed with "v" MUST exist' + required: true + type: string + itch_release: + description: Release to itch + default: true + type: boolean + upload_aab_artifact: + description: Add AAB artifact + default: true + type: boolean + upload_apk_artifact: + description: Add APK artifact + default: false + type: boolean + +env: + # Required because GitHub-hosted runners provide an incompatible NDK + ANDROID_NDK_HOME: "" + RENPY_VERSION: ${{ vars.RENPY_VERSION || '8.1.3' }} + +jobs: + android_build: + runs-on: ubuntu-latest + name: Android package build + + steps: + - uses: actions/checkout@v3 + with: + ref: v${{ inputs.version_number }} + path: project + - uses: actions/setup-java@v3 + with: + distribution: 'adopt-hotspot' + java-version: '8' + - name: Create keystore + run: base64 -d <<<"$ANDROID_KEYSTORE" >android.keystore + env: + ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} + - name: "Lookup Ren'Py cache" + id: cache-renpy + uses: actions/cache@v3 + with: + path: renpy + key: ${{ runner.os }}-renpy-${{ env.RENPY_VERSION }}-android + - name: "Install Ren'Py" + uses: Ayowel/renpy-setup-action@v2 + if: steps.cache-renpy.outputs.cache-hit != 'true' + with: + action: install + install_dir: renpy + version: ${{ env.RENPY_VERSION }} + dlc: rapt + android_sdk: true + android_properties: | + key.alias=${{ vars.ANDROID_KEYSTORE_ALIAS || 'android' }} + key.store.password=${{ secrets.ANDROID_KEYSTORE_PASSWORD || 'android' }} + key.alias.password=${{ secrets.ANDROID_ALIAS_PASSWORD || 'android' }} + key.store=${{ github.workspace }}/android.keystore + + - name: Build android AAB file + uses: Ayowel/renpy-setup-action@v2 + if: inputs.upload_aab_artifact + with: + action: android_build + install_dir: renpy + build_type: aab + game: project + out_dir: target + + - name: Build android APK file + uses: Ayowel/renpy-setup-action@v2 + if: inputs.itch_release || inputs.upload_apk_artifact + with: + action: android_build + install_dir: renpy + build_type: apk + game: project + out_dir: target + + - name: Make Play Store build available as workflow artifact + uses: actions/upload-artifact@v3 + if: inputs.upload_aab_artifact + with: + name: Colors_${{ inputs.version_number }}_android_aab + path: target/*.aab + + - name: Make Universal APK build available as workflow artifact + uses: actions/upload-artifact@v3 + if: inputs.upload_apk_artifact + with: + name: Colors_${{ inputs.version_number }}_android_apk + path: target/*.apk + + - name: Push APK build to itch.io + uses: Ayowel/butler-to-itch@v1.0.0 + if: inputs.itch_release + with: + butler_key: ${{ secrets.BUTLER_CREDENTIALS }} + itch_game: ${{ vars.ITCH_GAME }} + itch_user: ${{ vars.ITCH_USER }} + files: mobile target/*.apk + version: ${{ inputs.version_number }} diff --git a/.github/workflows/release_tag.yml b/.github/workflows/release_tag.yml index cd8aa00..c2f519f 100644 --- a/.github/workflows/release_tag.yml +++ b/.github/workflows/release_tag.yml @@ -15,6 +15,16 @@ jobs: - uses: actions/checkout@v3 - name: Update recorded version run: sed -i -Ee 's/(config.version\s*=\s*")[^"]+"/\1${{ inputs.version_number }}"/g' game/options.rpy + - name: Update android version + run: | + python3 - <