Build PojavLauncher Daily ☀️ #75
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: "Build PojavLauncher Daily ☀️" | |
on: | |
schedule: | |
- cron: '0 0 * * *' # A new day, a new adventure! 🌅 | |
workflow_dispatch: | |
jobs: | |
build: | |
# Our reliable builder buddy 🛠️ | |
runs-on: ubuntu-22.04 | |
env: | |
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} | |
steps: | |
# 🏡 Starting with a clean slate! | |
- name: "🏡 Start Fresh" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 # No baggage, just the essentials! 🎒 | |
- name: "🌟 Clone Repository and Extract Commit Info" | |
run: | | |
./scripts/pojav/clone_and_extract.sh | |
- name: "🔍 Retrieve Latest Release Commit Hash" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Looking for previous build info... 🕵️♂️" | |
gh release download --repo arctlite/apps-ci --pattern "commit_hash.txt" --dir ./release_info || echo "No previous build info found! Starting fresh. 🌱" | |
if [ -f ./release_info/commit_hash.txt ]; then | |
PREVIOUS_COMMIT_HASH=$(cat ./release_info/commit_hash.txt) | |
echo "Found previous commit hash: $PREVIOUS_COMMIT_HASH 🗂️" | |
echo "PREVIOUS_COMMIT_HASH=$PREVIOUS_COMMIT_HASH" >> $GITHUB_ENV | |
else | |
echo "No previous commit hash. It's a clean start! 🌟" | |
echo "PREVIOUS_COMMIT_HASH=" >> $GITHUB_ENV | |
fi | |
- name: "🔄 Compare Commit Hashes" | |
run: | | |
if [ "$PREVIOUS_COMMIT_HASH" == "$CURRENT_COMMIT_HASH" ]; then | |
echo "No changes detected since the last build. Take the day off! 🌴" | |
exit 1 # Exiting gracefully to save resources | |
else | |
echo "New changes spotted — let's get to work! 🛠️" | |
fi | |
- name: "🌿 Brew Some Java (JDK 17)" | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get JRE 8 | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build.yml | |
path: pojav/app_pojavlauncher/src/main/assets/components/jre | |
workflow_conclusion: success | |
repo: PojavLauncherTeam/android-openjdk-build-multiarch | |
branch: buildjre8 | |
name: jre8-pojav | |
- name: Get JRE17 | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build.yml | |
path: pojav/app_pojavlauncher/src/main/assets/components/jre-new | |
workflow_conclusion: success | |
repo: PojavLauncherTeam/android-openjdk-build-multiarch | |
branch: buildjre17-21 | |
name: jre17-pojav | |
- name: Get JRE21 | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build.yml | |
path: pojav/app_pojavlauncher/src/main/assets/components/jre-21 | |
workflow_conclusion: success | |
repo: PojavLauncherTeam/android-openjdk-build-multiarch | |
branch: buildjre17-21 | |
name: jre21-pojav | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: 7.6.1 | |
- name: "⚒️ Build JRE JAR files" | |
run: | | |
cd pojav | |
./scripts/languagelist_updater.sh | |
mkdir out | |
# Build JRE JAR files (security manager, etc...) | |
gradle :jre_lwjgl3glfw:build --no-daemon | |
- name: "🛠️ Setting Up the Toolshed (Android SDK)" | |
run: ./scripts/setup_sdk.sh | |
- name: "🛠️ Build APKs" | |
run: | | |
cd pojav | |
../scripts/pojav/build_apks.sh | |
echo "APKs built to perfection! 🏗️✨" | |
- name: "🖋️ Sign APKs" | |
env: | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
run: | | |
cd pojav | |
../scripts/pojav/sign_apks.sh | |
echo "Signed, sealed, and ready to deliver! 📜📦" | |
- name: "📦 Create GitHub Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Dynamically generate the tag using the shortened commit hash | |
APP_NAME="pojavlauncher" | |
SHORT_COMMIT_HASH=${CURRENT_COMMIT_HASH:0:7} | |
TAG_NAME="${APP_NAME}-${SHORT_COMMIT_HASH}" | |
echo "Using tag: $TAG_NAME" | |
gh release create "$TAG_NAME" \ | |
--title "${APP_NAME} Build (${TAG_NAME})" \ | |
--notes "✨ Automated build of ${APP_NAME}. ✨ | |
**Commit Details** | |
- **Hash**: $CURRENT_COMMIT_HASH | |
- **Message**: $CURRENT_COMMIT_MSG | |
- **Author**: $CURRENT_COMMIT_AUTHOR | |
- **Date**: $CURRENT_COMMIT_DATE" \ | |
--target main | |
- name: "📤 Upload Each APK to Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
SHORT_COMMIT_HASH=${CURRENT_COMMIT_HASH:0:7} | |
TAG_NAME="${APP_NAME}-${SHORT_COMMIT_HASH}" | |
echo "Sending the APKs off to their new home! 🏠" | |
gh release upload "pojavlauncher-${SHORT_COMMIT_HASH}" "pojav/app_pojavlauncher/build/outputs/apk/release/app_pojavlauncher-signed.apk" --clobber | |
- name: "📤 Upload Commit Hash to Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
SHORT_COMMIT_HASH=${CURRENT_COMMIT_HASH:0:7} | |
TAG_NAME="${APP_NAME}-${SHORT_COMMIT_HASH}" | |
echo "Saving the commit hash for posterity. 📖" | |
echo $CURRENT_COMMIT_HASH > commit_hash.txt | |
gh release upload "pojavlauncher-${SHORT_COMMIT_HASH}" "commit_hash.txt" | |
echo "Commit hash uploaded successfully! 📝" | |