Skip to content

Commit

Permalink
更新 GitHub Actions 工作流,增加对 push 事件的支持,重命名步骤并增加注释,同时修改 APK 构建与上传逻辑以支持同时…
Browse files Browse the repository at this point in the history
…生成 Normal 和 Compatible APK。
  • Loading branch information
Fansirsqi committed Nov 20, 2024
1 parent 8d1c9de commit cec97dd
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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%

0 comments on commit cec97dd

Please sign in to comment.