This repository was archived by the owner on Mar 18, 2026. It is now read-only.
Auto Build Android #11
This file contains hidden or 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: Auto Build Android | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| detect-latest: | |
| name: Check latest Godot version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| godot_version: ${{ steps.detect.outputs.godot_version }} | |
| should_build: ${{ steps.detect.outputs.should_build }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| - name: Set plugin version on env | |
| run: | | |
| PLUGIN_VERSION=$(find . -name "package.gd" -exec grep 'const VERSION' {} \; | head -n 1 | awk -F'"' '{print $2}') | |
| echo "PLUGIN_VERSION=v${PLUGIN_VERSION}" >> $GITHUB_ENV | |
| - name: Detect latest Godot version | |
| id: detect | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| LATEST=$(gh api repos/godotengine/godot/releases \ | |
| --jq '[.[] | select(.tag_name | test("^4\\.[0-9]+(\\.[0-9]+)?-stable$")) | .tag_name][0]' \ | |
| | sed 's/-stable//' \ | |
| | awk -F. '{if(NF==2) print $0".0"; else print $0}') | |
| echo "Latest Godot version: $LATEST" | |
| RELEASE_EXISTS=$(gh api "repos/${{ github.repository }}/releases/tags/${PLUGIN_VERSION}" > /dev/null 2>&1 && echo "true" || echo "false") | |
| if [ "$RELEASE_EXISTS" = "true" ]; then | |
| EXISTS=$(gh api "repos/${{ github.repository }}/releases/tags/${PLUGIN_VERSION}" \ | |
| --jq ".assets[].name" 2>/dev/null \ | |
| | grep -q "poing-godot-admob-android-v${LATEST}.zip" && echo "true" || echo "false") | |
| else | |
| EXISTS="false" | |
| fi | |
| if [ "$EXISTS" = "true" ]; then | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| echo "Already built for $LATEST" | |
| else | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| echo "godot_version=$LATEST" >> $GITHUB_OUTPUT | |
| echo "Need to build for $LATEST" | |
| fi | |
| android-template: | |
| name: Compiling Gradle (Android) | |
| needs: detect-latest | |
| if: needs.detect-latest.outputs.should_build == 'true' | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| - name: Set plugin version on env | |
| run: | | |
| PLUGIN_VERSION=$(find . -name "package.gd" -exec grep 'const VERSION' {} \; | head -n 1 | awk -F'"' '{print $2}') | |
| echo "PLUGIN_VERSION=v${PLUGIN_VERSION}" >> $GITHUB_ENV | |
| - name: Build Plugins | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew build -PgodotVersion=${{ needs.detect-latest.outputs.godot_version }} | |
| - name: Compress the artifact output | |
| run: | | |
| ./gradlew zipPlugins -PgodotVersion="${{ needs.detect-latest.outputs.godot_version }}" | |
| - name: Upload binaries to release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| target_commit: ${{ github.ref_name }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: .output/poing-godot-admob-android-v${{ needs.detect-latest.outputs.godot_version }}.zip | |
| tag: ${{env.PLUGIN_VERSION}} | |
| overwrite: true |