[feature|optimize] Support check update; convert about screen, more s… #52
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: Pre-Release | |
# Trigger | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
paths-ignore: | |
- '**.md' | |
- 'doc/**' | |
- 'image/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Checkout Secret | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.SECRET_REPO }} | |
token: ${{ secrets.TOKEN }} # Repo token | |
path: secret | |
# Prepare secret files | |
- name: Copy Secret Files | |
run: | | |
cd secret/AniVu | |
cp key.jks ../.. | |
cp secret.gradle.kts ../.. | |
# Clean secret files | |
- name: Clean Temp Secret Files | |
run: | | |
rm -rf ./secret | |
# Build | |
- name: Build with Gradle | |
run: | | |
bash ./gradlew assembleGitHubRelease | |
# Upload apk (arm64-v8a) | |
- name: Upload Pre-Release Apk (arm64-v8a) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Apk (arm64-v8a) | |
path: app/build/outputs/apk/GitHub/release/*arm64-v8a*.apk | |
# Upload apk (armeabi-v7a) | |
- name: Upload Pre-Release Apk (armeabi-v7a) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Apk (armeabi-v7a) | |
path: app/build/outputs/apk/GitHub/release/*armeabi-v7a*.apk | |
# Upload apk (x86_64) | |
- name: Upload Pre-Release Apk (x86_64) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Apk (x86_64) | |
path: app/build/outputs/apk/GitHub/release/*x86_64*.apk | |
# Upload apk (x86) | |
- name: Upload Pre-Release Apk (x86) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Apk (x86) | |
path: | | |
app/build/outputs/apk/GitHub/release/*x86*.apk | |
!app/build/outputs/apk/GitHub/release/*x86_64*.apk | |
# Upload apk (universal) | |
- name: Upload Pre-Release Apk (universal) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Apk (universal) | |
path: app/build/outputs/apk/GitHub/release/*universal*.apk | |
# Upload mapping | |
- name: Upload Pre-Release Mapping | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Pre-Release Mapping | |
path: app/build/outputs/mapping/GitHubRelease/mapping.txt | |
# Get apk path | |
- name: Get Pre-Release Apk File Path | |
run: | | |
echo "PRE_RELEASE_APK_ARM64_V8=$(find app/build/outputs/apk/GitHub/release -name '*arm64-v8a*.apk' -type f | head -1)" >> $GITHUB_ENV | |
echo "PRE_RELEASE_APK_ARM_V7=$(find app/build/outputs/apk/GitHub/release -name '*armeabi-v7a*.apk' -type f | head -1)" >> $GITHUB_ENV | |
echo "PRE_RELEASE_APK_X86_64=$(find app/build/outputs/apk/GitHub/release -name '*x86_64*.apk' -type f | head -1)" >> $GITHUB_ENV | |
echo "PRE_RELEASE_APK_X86=$(find app/build/outputs/apk/GitHub/release -name '*x86*.apk' -type f | head -1)" >> $GITHUB_ENV | |
echo "PRE_RELEASE_APK_UNIVERSAL=$(find app/build/outputs/apk/GitHub/release -name '*universal*.apk' -type f | head -1)" >> $GITHUB_ENV | |
# Send to Telegram | |
- name: Post to Telegram Channel | |
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[skip_post]') == false | |
env: | |
CHANNEL_ID: ${{ secrets.TELEGRAM_TO }} | |
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
PRE_RELEASE_ARM64_V8: ${{ env.PRE_RELEASE_APK_ARM64_V8 }} | |
PRE_RELEASE_ARM_V7: ${{ env.PRE_RELEASE_APK_ARM_V7 }} | |
PRE_RELEASE_X86_64: ${{ env.PRE_RELEASE_APK_X86_64 }} | |
PRE_RELEASE_X86: ${{ env.PRE_RELEASE_APK_X86 }} | |
PRE_RELEASE_UNIVERSAL: ${{ env.PRE_RELEASE_APK_UNIVERSAL }} | |
COMMIT_MESSAGE: |+ | |
GitHub New CI: AniVu\ | |
`${{ github.event.head_commit.message }}` | |
by `${{ github.event.head_commit.author.name }}` | |
Commit details [here](${{ github.event.head_commit.url }}) | |
run: | | |
ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'` | |
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fpre_release_arm64_v8%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fpre_release_arm_v7%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" -F pre_release_arm64_v8="@$PRE_RELEASE_ARM64_V8" -F pre_release_arm_v7="@$PRE_RELEASE_ARM_V7" |