Nightly Build #440
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: Nightly Build | |
| on: | |
| schedule: | |
| # Nightly build at 02:30 UTC. | |
| - cron: '30 2 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| nightly: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Make gradlew executable | |
| run: chmod +x gradlew | |
| - name: Build debug APK | |
| run: ./gradlew assembleDebug --stacktrace | |
| - name: Get version info | |
| id: version | |
| run: | | |
| echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| echo "sha_short=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT | |
| - name: List and rename APKs | |
| id: apks | |
| run: | | |
| cd build/outputs/apk/debug | |
| echo "APKs built:" | |
| ls -la *.apk | |
| # Rename all APKs with version info | |
| for apk in *.apk; do | |
| # Extract ABI from filename (e.g., tribixbite.cleverkeys-arm64-v8a-debug.apk) | |
| if [[ "$apk" == *"universal"* ]]; then | |
| newname="CleverKeys-${{ steps.version.outputs.sha_short }}-universal.apk" | |
| elif [[ "$apk" == *"arm64-v8a"* ]]; then | |
| newname="CleverKeys-${{ steps.version.outputs.sha_short }}-arm64.apk" | |
| elif [[ "$apk" == *"armeabi-v7a"* ]]; then | |
| newname="CleverKeys-${{ steps.version.outputs.sha_short }}-armv7.apk" | |
| elif [[ "$apk" == *"x86_64"* ]]; then | |
| newname="CleverKeys-${{ steps.version.outputs.sha_short }}-x86_64.apk" | |
| else | |
| newname="CleverKeys-${{ steps.version.outputs.sha_short }}.apk" | |
| fi | |
| mv "$apk" "$newname" | |
| echo "Renamed: $apk -> $newname" | |
| done | |
| ls -la *.apk | |
| - name: Prune old nightly assets | |
| # APK names embed the commit SHA, so overwrite_files never matches and | |
| # assets accumulate until GitHub's hard cap of 1000 per release (hit | |
| # 2026-07-15, failing every nightly upload). Keep the newest 30 | |
| # (~7 nightlies at 4 APKs each) and delete the rest before uploading. | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh api "repos/${{ github.repository }}/releases/tags/nightly" \ | |
| --jq '.assets | sort_by(.created_at) | reverse | .[30:] | .[].id' | | |
| while read -r id; do | |
| gh api -X DELETE "repos/${{ github.repository }}/releases/assets/$id" \ | |
| && echo "Deleted asset $id" || echo "::warning::Failed to delete asset $id" | |
| done | |
| - name: Update nightly release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: "🌙 Nightly Build" | |
| body: | | |
| ## Nightly Build - ${{ steps.version.outputs.date }} | |
| **Commit**: `${{ steps.version.outputs.sha_short }}` (${{ github.sha }}) | |
| ⚠️ **This is an automated development build.** It may contain bugs or incomplete features. | |
| ### Downloads (per-ABI for smaller size) | |
| | ABI | Size | Device | | |
| |-----|------|--------| | |
| | **arm64** | ~35MB | Most modern phones (2017+) | | |
| | **armv7** | ~30MB | Older 32-bit phones | | |
| | **x86_64** | ~35MB | Emulators, Chromebooks | | |
| | **universal** | ~52MB | All devices (larger) | | |
| ### For Stable Releases | |
| See [Releases](https://github.com/${{ github.repository }}/releases) for stable versions. | |
| --- | |
| 🦝✨ *Built automatically from main branch* | |
| files: build/outputs/apk/debug/*.apk | |
| prerelease: true | |
| make_latest: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Nightly summary | |
| run: | | |
| echo "## 🌙 Nightly Build Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Date**: ${{ steps.version.outputs.date }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Commit**: ${{ steps.version.outputs.sha_short }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Download**: [CleverKeys-nightly.apk](https://github.com/${{ github.repository }}/releases/tag/nightly)" >> $GITHUB_STEP_SUMMARY |