immersive-home/.github/workflows/build-prod.yml

85 lines
3.1 KiB
YAML
Raw Normal View History

2023-11-21 00:33:32 +02:00
# Build the Android APK on push to the master branch
name: Build Release APK
on:
push:
tags:
- "v*"
- "!v*-test"
env:
GODOT_VERSION: 4.2
2023-11-21 00:33:32 +02:00
EXPORT_NAME: immersive-home
2023-11-21 02:07:20 +02:00
GODOT_ANDROID_KEYSTORE_RELEASE_PATH: /home/runner/work/Immersive-Home/Immersive-Home/release.keystore
GODOT_ANDROID_KEYSTORE_RELEASE_USER: ${{ secrets.RELEASE_USER }}
GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }}
2023-11-21 00:33:32 +02:00
jobs:
# job id, can be anything
export_game:
# Always use ubuntu-latest for this action
runs-on: ubuntu-latest
# Add permission for release creation. Can be made narrower according to your needs
permissions: write-all
# Job name, can be anything
name: Export Game
steps:
# Always include the checkout step so that
# your project is available for Godot to export
- name: checkout
uses: actions/checkout@v3.3.0
with:
lfs: true
2023-11-21 13:44:44 +02:00
fetch-depth: 0
2023-11-21 00:33:32 +02:00
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Android Export
run: |
2023-11-21 02:40:42 +02:00
sdkmanager "build-tools;32.0.0"
2023-11-21 00:33:32 +02:00
echo "${{ secrets.KEYSTORE_RELEASE }}" | base64 -di > release.keystore
mkdir -p ./android/build
touch ./android/build/.gdignore
2023-12-14 00:50:39 +02:00
wget -nv https://downloads.tuxfamily.org/godotengine/4.1.3/Godot_v4.1.3-stable_export_templates.tpz -O ./godot_templates.tpz
unzip -q ./godot_templates.tpz -d .
rm ./godot_templates.tpz
unzip -q ./templates/android_source.zip -d ./android/build/
rm ./templates/android_source.zip
sed -i 's/singleInstancePerTask/singleTask/g' ./android/build/AndroidManifest.xml
2023-12-14 00:16:16 +02:00
versioncode=$(eval "git tag | grep -v "test" | wc -l")
2023-12-14 00:50:39 +02:00
sed -i "s/BUILD_VERSION_CODE/$versioncode/g" export_presets.cfg
sed -i "s/android:versionCode=\"1\"/android:versionCode=\"$versioncode\"/g" ./android/build/AndroidManifest.xml
sed -i 's/BUILD_VERSION/${{ github.ref_name }}/g' export_presets.cfg
sed -i "s/android:versionName=\"1.0\"/android:versionName=\"${{ github.ref_name }}\"/g" ./android/build/AndroidManifest.xml
2023-12-14 00:16:16 +02:00
2023-11-21 00:33:32 +02:00
- name: export game
id: export
# Use latest version (see releases for all versions)
2023-12-11 21:42:47 +02:00
uses: nitwel/godot-export@latest
2023-11-21 00:33:32 +02:00
with:
# Defining all the required inputs
godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/4.2/Godot_v4.2-stable_linux.x86_64.zip
godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/4.2/Godot_v4.2-stable_export_templates.tpz
2023-11-21 00:33:32 +02:00
relative_project_path: ./
archive_output: true
2023-12-11 21:42:47 +02:00
filter_exports: "AndroidProduction"
2023-11-21 00:33:32 +02:00
- name: create release
uses: ncipollo/release-action@v1.11.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
artifacts: ${{ steps.export.outputs.archive_directory }}/* # Added "/*" at the end is glob pattern match for this action