🎉Release 1.3,3863串口log提示 #123
Workflow file for this run
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: Android CI Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: NLChat # 确保代码被检出到NLChat目录 | |
- name: Set up JDK 17 | |
id: setup-java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set JAVA_HOME | |
run: echo "JAVA_HOME=${{ steps.setup-java.outputs.path }}" >> $GITHUB_ENV | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: 'current' # 使用最新的 Gradle 版本 | |
- name: Grant execute permission for gradlew | |
run: chmod +x NLChat/gradlew | |
- name: Build Project | |
env: | |
JAVA_HOME: ${{ steps.setup-java.outputs.path }} # 显式设置 JAVA_HOME | |
run: | | |
echo "JAVA_HOME=${JAVA_HOME}" # 确认 JAVA_HOME 已设置 | |
cd NLChat | |
./gradlew assembleRelease | |
./gradlew bundleRelease | |
- name: Sign APK | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDirectory: NLChat/app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Sign AAB | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_aab | |
with: | |
releaseDirectory: NLChat/app/build/outputs/bundle/release # 修改路径为 AAB 文件目录 | |
signingKeyBase64: ${{ secrets.SIGING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: List files in APK release directory | |
run: ls -R NLChat/app/build/outputs/apk/release | |
- name: List files in AAB release directory | |
run: ls -R NLChat/app/build/outputs/bundle/release | |
- name: Upload Signed APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: signed-apk | |
path: NLChat/app/build/outputs/apk/release/app-release-unsigned-signed.apk | |
- name: Upload Signed AAB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: signed-aab | |
path: NLChat/app/build/outputs/bundle/release/app-release.aab | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: NLChat # 确保代码被检出到NLChat目录 | |
- name: Download Signed APK | |
uses: actions/download-artifact@v3 | |
with: | |
name: signed-apk | |
path: NLChat/app/build/outputs/apk/release | |
- name: Release Ready | |
run: | | |
if [ -f "NLChat/app/build/outputs/apk/release/app-release-unsigned-signed.apk" ]; then | |
mv NLChat/app/build/outputs/apk/release/app-release-unsigned-signed.apk NLChat_${{ github.ref_name }}.apk | |
else | |
echo "Error: APK file not found!" | |
exit 1 | |
fi | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "NLChat_${{ github.ref_name }}.apk" | |
token: ${{ secrets.GITHUB_TOKEN }} # 使用 PAT | |
generateReleaseNotes: true | |
- name: Get Commit Message | |
id: get_commit_message | |
run: | | |
cd NLChat | |
echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV | |
continue-on-error: true | |
- name: Create or Update Release Notes | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: ${{ github.ref_name }} | |
body: ${{ env.COMMIT_MESSAGE }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用环境变量 | |
continue-on-error: true | |
multi-platform-test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
api-level: [28, 29, 31, 33] # 你可以根据需要调整 API 级别 | |
target: [default, google_apis] | |
arch: [x86_64, arm64-v8a] # 你可以根据需要调整架构 | |
include: | |
- api-level: 29 | |
target: default | |
arch: x86_64 | |
- api-level: 29 | |
target: default | |
arch: arm64-v8a | |
- api-level: 29 | |
target: google_apis | |
arch: arm64-v8a | |
- api-level: 31 | |
target: default | |
arch: x86_64 | |
- api-level: 31 | |
target: google_apis | |
arch: x86_64 | |
- api-level: 31 | |
target: google_apis | |
arch: arm64-v8a | |
- api-level: 33 | |
target: default | |
arch: x86_64 | |
- api-level: 33 | |
target: google_apis | |
arch: x86_64 | |
- api-level: 33 | |
target: google_apis | |
arch: arm64-v8a | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Instrumentation Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
arch: x86_64 | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: ./gradlew connectedAndroidTest --stacktrace |