forked from constanline/XQuickEnergy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新 GitHub Actions 工作流,增加对 push 事件的支持,重命名步骤并增加注释,同时修改 APK 构建与上传逻辑以支持同时…
…生成 Normal 和 Compatible APK。
- Loading branch information
Showing
1 changed file
with
24 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,39 @@ name: Android CI | |
on: | ||
release: | ||
types: [published] | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# 检出代码 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: set up JDK 11 | ||
# 设置 JDK 11 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: gradle | ||
|
||
# 赋予 Gradlew 执行权限 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew assembleRelease -P version=${{ github.ref_name }} | ||
# 同时编译 Normal 和 Compatible APK | ||
- name: Build Normal and Compatible APKs | ||
run: | | ||
./gradlew assembleNormalRelease assembleCompatibleRelease -Pversion=${{ github.ref_name }} | ||
# 签名 Normal APK | ||
- name: Sign Normal APK | ||
id: sign_normal_apk | ||
uses: ilharp/sign-android-release@v1 | ||
|
@@ -38,6 +47,7 @@ jobs: | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | ||
buildToolsVersion: 31.0.0 | ||
|
||
# 签名 Compatible APK | ||
- name: Sign Compatible APK | ||
id: sign_compatible_apk | ||
uses: ilharp/sign-android-release@v1 | ||
|
@@ -49,24 +59,26 @@ jobs: | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | ||
buildToolsVersion: 31.0.0 | ||
|
||
- name: Upload Normal to Release | ||
# 上传 Normal APK 到 Release | ||
- name: Upload Normal APK to Release | ||
uses: termux/[email protected] | ||
with: | ||
asset_name: Sesame-Normal-${{ github.event.release.tag_name }}.apk | ||
asset_name: Sesame-Normal-${{ github.event.release.tag_name || github.ref_name }}.apk | ||
file: ${{ steps.sign_normal_apk.outputs.signedFile }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref }} | ||
tag: ${{ github.ref_name }} | ||
overwrite: true | ||
checksums: sha256 | ||
checksums_file_name: CHECKSUMS-Sesame-Normal-${{ github.event.release.tag_name }}.%algo% | ||
checksums_file_name: CHECKSUMS-Sesame-Normal-${{ github.event.release.tag_name || github.ref_name }}.%algo% | ||
|
||
- name: Upload Compatible to Release | ||
# 上传 Compatible APK 到 Release | ||
- name: Upload Compatible APK to Release | ||
uses: termux/[email protected] | ||
with: | ||
asset_name: Sesame-Compatible-${{ github.event.release.tag_name }}.apk | ||
asset_name: Sesame-Compatible-${{ github.event.release.tag_name || github.ref_name }}.apk | ||
file: ${{ steps.sign_compatible_apk.outputs.signedFile }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref }} | ||
tag: ${{ github.ref_name }} | ||
overwrite: true | ||
checksums: sha256 | ||
checksums_file_name: CHECKSUMS-Sesame-Compatible-${{ github.event.release.tag_name }}.%algo% | ||
checksums_file_name: CHECKSUMS-Sesame-Compatible-${{ github.event.release.tag_name || github.ref_name }}.%algo% |