Skip to content

Add service uptime screen and deep link support #278

Add service uptime screen and deep link support

Add service uptime screen and deep link support #278

Workflow file for this run

name: Android Build & Sign
on:
push:
branches: [main]
tags:
- 'v*'
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-gms-universal-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-gms-universal-
${{ runner.os }}-gradle-
- name: Create local.properties
run: echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
- name: Create google-services.json
if: env.HAS_GOOGLE_SERVICES == 'true'
env:
HAS_GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES_JSON != '' }}
GOOGLE_SERVICES_CONTENT: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: |
printf "%s" "$GOOGLE_SERVICES_CONTENT" > app/google-services.json
- name: Set up Signing Keystore
if: env.HAS_KEYSTORE == 'true'
env:
HAS_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE_BASE64 != '' }}
RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
run: |
mkdir -p app/keystore
echo "$RELEASE_KEYSTORE_BASE64" | base64 --decode > app/keystore/release.keystore
- name: Build and Sign Release APK (Push to main / Dispatch / Tag)
env:
STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
LASTFM_SECRET: ${{ secrets.LASTFM_SECRET }}
run: ./gradlew assembleUniversalGmsRelease
- name: Rename and Organize APKs
run: |
VERSION_NAME=$(grep "versionName =" app/build.gradle.kts | head -n 1 | awk -F '"' '{print $2}')
echo "App Version: $VERSION_NAME"
mkdir -p app/build/outputs/apk/release-artifacts
find app/build/outputs/apk/ -name "*.apk" ! -path "*/release-artifacts/*" | while read -r apk_path; do
target_name="Echo-${VERSION_NAME}-Universal.apk"
cp "$apk_path" "app/build/outputs/apk/release-artifacts/$target_name"
echo "Copied $apk_path -> app/build/outputs/apk/release-artifacts/$target_name"
done
- name: Upload APK Artifact
uses: actions/upload-artifact@v4
with:
name: Echo-Universal
path: app/build/outputs/apk/release-artifacts/*.apk
- name: Parse Release Info
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
# 1. Read first line and strip the "# " to get the Title
TITLE=$(head -n 1 RELEASE_INFO.md | sed 's/^# //')
echo "RELEASE_TITLE=$TITLE" >> $GITHUB_ENV
# 2. Read from line 3 onwards to get the Description body
tail -n +3 RELEASE_INFO.md > release-body.md
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
name: ${{ env.RELEASE_TITLE }}
body_path: release-body.md
files: app/build/outputs/apk/release-artifacts/*.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send Telegram Notification
if: startsWith(github.ref, 'refs/tags/v')
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_TITLE: ${{ env.RELEASE_TITLE }}
run: |
# Read release body
BODY=$(cat release-body.md)
# Escape HTML characters for Telegram and truncate if too long
SAFE_BODY=$(echo "$BODY" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g')
if [ ${#SAFE_BODY} -gt 3000 ]; then
SAFE_BODY="${SAFE_BODY:0:3000}..."$'\n\n'"[Changelog truncated due to length. See GitHub Release for full details.]"
fi
# Construct HTML formatted message (Telegram supports HTML tags)
if echo "$BODY" | grep -q "Support the Project"; then
MESSAGE="hello everyone,
<b>$RELEASE_TITLE</b>
$SAFE_BODY
Note: If you encounter an 'App not installed' error during installation, please uninstall the previous version before installing this update."
else
MESSAGE="hello everyone,
<b>$RELEASE_TITLE</b>
$SAFE_BODY
Note: If you encounter an 'App not installed' error during installation, please uninstall the previous version before installing this update.
Thank you for your continued support. If you encounter any issues, please report them through the usual channels.
<b>Support the Project</b>
If you'd like to support ongoing development, you can do so through any of the following:
• Buy Me a Coffee: https://buymeacoffee.com/iad1tya
• GitHub Sponsors: https://github.com/sponsors/iad1tya
• Support Page: https://support.iad1tya.cyou/
Every contribution helps support continued development, maintenance, and future improvements.
Thank you for your support, and enjoy the update!"
fi
# Create JSON payload securely using jq
jq -n \
--arg chat_id "$TELEGRAM_CHAT_ID" \
--arg text "$MESSAGE" \
--arg parse_mode "HTML" \
'{
chat_id: $chat_id,
text: $text,
parse_mode: $parse_mode,
disable_web_page_preview: true
}' > telegram-payload.json
# Send message using Telegram Bot API
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-H "Content-Type: application/json" \
-d @telegram-payload.json
- name: Send Discord Release Notification
if: startsWith(github.ref, 'refs/tags/v')
env:
DISCORD_RELEASE_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK || secrets.DISCORD_WEBHOOK }}
RELEASE_TITLE: ${{ env.RELEASE_TITLE }}
run: |
# Read release body
BODY=$(cat release-body.md)
# Construct ping text
PING_TEXT="@everyone New Release Available - **$RELEASE_TITLE**"
# Create Discord Embed JSON securely using jq
jq -n \
--arg ping "$PING_TEXT" \
--arg desc "$BODY" \
'{
content: $ping,
embeds: [{
title: "Release Changelog",
description: $desc,
color: 16738660,
footer: { text: "Echo Music Automation System" }
}]
}' > discord-release-payload.json
# Post to Discord Webhook if configured
if [ -n "$DISCORD_RELEASE_WEBHOOK" ]; then
curl -H "Content-Type: application/json" -d @discord-release-payload.json "$DISCORD_RELEASE_WEBHOOK"
else
echo "DISCORD_RELEASE_WEBHOOK is not set, skipping notification."
fi
- name: Send Discord Notification
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && !startsWith(github.ref, 'refs/tags/')
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
RELEASE_TITLE: ${{ env.RELEASE_TITLE }}
run: |
# Read release body
BODY=$(cat release-body.md)
# Fetch version name
VERSION_NAME=$(grep "versionName =" app/build.gradle.kts | head -n 1 | awk -F '"' '{print $2}')
# Set title and download link parameters
TARGET_TITLE="New Beta Build - v$VERSION_NAME"
DOWNLOAD_LINK="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
LINK_LABEL="Click here to download APK ZIP from GitHub Actions Run Page"
# Construct pings and warning messages
PING_TEXT="<@&1498758915536584714> New Build Available"
WARNING_TEXT="Note: If you're getting an update notification, there's no need to update since you're already using the latest version. Simply disable Automatic Update Check and Update Notifications in the update settings."
# Create Discord Embed JSON securely using jq
jq -n \
--arg ping "$PING_TEXT" \
--arg warn "$WARNING_TEXT" \
--arg title "$TARGET_TITLE" \
--arg desc "$BODY" \
--arg link "$DOWNLOAD_LINK" \
--arg label "$LINK_LABEL" \
'{
content: $ping,
embeds: [{
title: $title,
description: ($desc + "\n\n" + $warn),
color: 7303122,
fields: [
{ name: "Download APK", value: ("[" + $label + "](" + $link + ")"), inline: false }
],
footer: { text: "Echo Music Automation System" }
}]
}' > discord-payload.json
# Post to Discord Webhook
curl -H "Content-Type: application/json" -d @discord-payload.json "$DISCORD_WEBHOOK"