233 lines
8.9 KiB
YAML
233 lines
8.9 KiB
YAML
name: Build Latest
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- release.txt
|
|
- version.txt
|
|
|
|
jobs:
|
|
AlaskarTV:
|
|
runs-on: docker
|
|
container: ghcr.io/catthehacker/ubuntu:full-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download Latest Release
|
|
run: |
|
|
curl -s https://api.github.com/repos/jellyfin/jellyfin-androidtv/releases/latest \
|
|
| jq -r '.tarball_url' \
|
|
| xargs curl -L -o latest-release.tar.gz
|
|
|
|
- name: Extract Release Tarball
|
|
run: |
|
|
mkdir -p app-release
|
|
tar -xzf latest-release.tar.gz --strip-components=1 -C app-release
|
|
|
|
- name: Parse version.txt
|
|
id: parse_version
|
|
run: |
|
|
# Read values from version.txt
|
|
APPLICATION_ID=$(grep '^APPLICATION_ID=' version.txt | awk -F 'APPLICATION_ID=' '{print $2}')
|
|
VERSION_NAME=$(grep '^VERSION_NAME=' version.txt | awk -F 'VERSION_NAME=v' '{print $2}')
|
|
VERSION_CODE=$(grep '^VERSION_CODE=' version.txt | awk -F 'VERSION_CODE=' '{print $2}')
|
|
|
|
# Export values as environment variables
|
|
echo "APPLICATION_ID=$APPLICATION_ID" >> $GITHUB_ENV
|
|
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
|
|
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
|
|
|
|
- name: Replace Assets
|
|
run: |
|
|
rm -r app-release/app/src/main/res/mipmap-*
|
|
cp -r res/* app-release/app/src/main/res
|
|
|
|
- name: Update AndroidManifest.xml banner
|
|
run: |
|
|
sed -i 's/android:banner="@mipmap\/app_banner"/android:banner="@drawable\/app_banner"/' app-release/app/src/main/AndroidManifest.xml
|
|
|
|
- name: Update strings.xml
|
|
run: |
|
|
sed -i 's/Jellyfin/AlaskarTV/g' app-release/app/src/main/res/values/strings.xml
|
|
|
|
- name: Update build.gradle.kts
|
|
env:
|
|
APPLICATION_ID: ${{ env.APPLICATION_ID }}
|
|
VERSION_NAME: ${{ env.VERSION_NAME }}
|
|
VERSION_CODE: ${{ env.VERSION_CODE }}
|
|
run: |
|
|
sed -i 's/applicationId = namespace/applicationId = "'"$APPLICATION_ID"'"/' app-release/app/build.gradle.kts
|
|
sed -i 's/versionName = .*/versionName = "'"$VERSION_NAME"'"/' app-release/app/build.gradle.kts
|
|
sed -i "s/versionCode = .*/versionCode = $VERSION_CODE/" app-release/app/build.gradle.kts
|
|
sed -i "s/setProperty(\"archivesBaseName\", \".*\")/setProperty(\"archivesBaseName\", \"alaskartv-androidtv-v$VERSION_NAME\")/" app-release/app/build.gradle.kts
|
|
|
|
- name: Update about.kt
|
|
run: |
|
|
sed -i '
|
|
s/title = "Jellyfin app version"/title = "AlaskarTV app version"/
|
|
s/content = "jellyfin-androidtv .*/content = "alaskartv-androidtv v${BuildConfig.VERSION_NAME} ${BuildConfig.BUILD_TYPE}"/
|
|
s/icon = R.drawable.ic_jellyfin/icon = R.drawable.app_icon_foreground_monochrome/
|
|
' app-release/app/src/main/java/org/jellyfin/androidtv/ui/preference/category/about.kt
|
|
|
|
- name: Update UserPreferences.kt
|
|
run: |
|
|
sed -i 's/booleanPreference("trick_play_enabled", false)/booleanPreference("trick_play_enabled", true)/' \
|
|
app-release/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt
|
|
|
|
sed -i 's/enumPreference("app_theme", AppTheme.DARK)/enumPreference("app_theme", AppTheme.MUTED_PURPLE)/' \
|
|
app-release/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt
|
|
|
|
- name: Update SelectServerFragment.kt
|
|
run: |
|
|
sed -i 's/jellyfin-androidtv/alaskartv-androidtv/' \
|
|
app-release/app/src/main/java/org/jellyfin/androidtv/ui/startup/fragment/SelectServerFragment.kt
|
|
|
|
- name: Parse release.txt
|
|
id: parse_release
|
|
run: |
|
|
VERSION_RELEASE=$(cat release.txt)
|
|
echo "VERSION_RELEASE=$VERSION_RELEASE" >> $GITHUB_ENV
|
|
|
|
- name: Push Source Code
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
VERSION_NAME: ${{ env.VERSION_NAME }}
|
|
VERSION_RELEASE: ${{ env.VERSION_RELEASE }}
|
|
run: |
|
|
cd app-release
|
|
rm -rf .git .github CODEOWNERS CONTRIBUTORS.md README.md
|
|
git init
|
|
git config --global user.email "no-reply@askar.tv"
|
|
git config --global user.name "AlaskarTV-Bot"
|
|
git remote add origin https://${FORGEJO_TOKEN}:@git.askar.tv/nomad/alaskartv-source.git
|
|
git add .
|
|
git commit -m "Bumped to v${VERSION_NAME} : Release ${VERSION_RELEASE}"
|
|
git branch -M main
|
|
git push origin main --force
|
|
|
|
- name: Set up Java
|
|
uses: https://github.com/actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
|
|
- name: Cache Gradle dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-21release-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-21release-
|
|
|
|
- name: Build APK
|
|
run: |
|
|
cd app-release
|
|
./gradlew assembleRelease
|
|
|
|
- name: Build AAB
|
|
run: |
|
|
cd app-release
|
|
./gradlew bundleRelease
|
|
|
|
- name: Sign APK
|
|
uses: https://github.com/ilharp/sign-android-release@v1
|
|
id: sign_apk
|
|
with:
|
|
releaseDir: app-release/app/build/outputs/apk/release
|
|
signingKey: ${{ secrets.KEYSTORE_FILE }}
|
|
keyAlias: ${{ secrets.KEYSTORE_ALIAS }}
|
|
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
buildToolsVersion: 35.0.0
|
|
|
|
- name: Sign AAB
|
|
uses: https://github.com/ilharp/sign-android-release@v1
|
|
id: sign_aab
|
|
with:
|
|
releaseDir: app-release/app/build/outputs/bundle/release
|
|
signingKey: ${{ secrets.KEYSTORE_FILE }}
|
|
keyAlias: ${{ secrets.KEYSTORE_ALIAS }}
|
|
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
buildToolsVersion: 35.0.0
|
|
|
|
- name: Upload Signed APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: signed-apk
|
|
path: ${{ steps.sign_apk.outputs.signedFiles }}
|
|
|
|
- name: Upload Signed AAB
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: signed-aab
|
|
path: ${{ steps.sign_aab.outputs.signedFiles }}
|
|
|
|
- name: Upload Debug Symbols
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: debug-symbols
|
|
path: app-release/app/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/*
|
|
|
|
- name: Check Debug Symbols Path
|
|
run: ls -la app-release/app/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/
|
|
|
|
|
|
- name: Prepare Release Assets
|
|
run: |
|
|
mkdir -p ./release-assets
|
|
|
|
mv ${{ steps.sign_apk.outputs.signedFiles }} ./release-assets/AlaskarTV-v${{ env.VERSION_NAME }}-signed.apk
|
|
mv ${{ steps.sign_aab.outputs.signedFiles }} ./release-assets/AlaskarTV-v${{ env.VERSION_NAME }}-signed.aab
|
|
zip -r ./release-assets/debug-symbols.zip app-release/app/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/*/
|
|
env:
|
|
VERSION_NAME: ${{ env.VERSION_NAME }}
|
|
VERSION_CODE: ${{ env.VERSION_CODE }}
|
|
|
|
|
|
- name: Fetch Release Notes
|
|
id: fetch-release-notes
|
|
run: |
|
|
TAG=$(cat release.txt)
|
|
echo "Fetching release notes for tag: $TAG"
|
|
RELEASE_NOTES=$(curl -s "https://api.github.com/repos/jellyfin/jellyfin-androidtv/releases/tags/$TAG" | jq -r '.body')
|
|
|
|
if [ -z "$RELEASE_NOTES" ] || [ "$RELEASE_NOTES" == "null" ]; then
|
|
echo "Error: Release notes not found for tag $TAG."
|
|
exit 1
|
|
fi
|
|
|
|
echo "# ️️️⬆️ Upstream Release Notes\n\n$RELEASE_NOTES" > release-notes.md
|
|
|
|
- name: Create Release and Upload Assets
|
|
uses: actions/forgejo-release@v2
|
|
with:
|
|
url: https://git.askar.tv
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
|
tag: "v${{ env.VERSION_NAME }}"
|
|
title: "AlaskarTV-v${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}"
|
|
release-notes: "$(cat release-notes.md)"
|
|
release-dir: ./release-assets
|
|
direction: upload
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
VERSION_NAME: ${{ env.VERSION_NAME }}
|
|
VERSION_CODE: ${{ env.VERSION_CODE }}
|
|
|
|
- name: Notify
|
|
uses: https://github.com/appleboy/telegram-action@master
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_ID }}
|
|
token: ${{ secrets.TELEGRAM_BOT }}
|
|
message: |
|
|
${{ github.actor }}:
|
|
Commit message: ${{ github.event.commits[0].message }}
|
|
AlaskarTV Built Successfully
|
|
See changes: https://git.askar.tv/nomad/alaskartv-app/releases/tag/v${{ env.VERSION_NAME }}
|
|
|
|
[Publish to GooglePlay](https://apo.askar.tv/api/publish)
|
|
|
|
env:
|
|
VERSION_NAME: ${{ env.VERSION_NAME }}
|