🎉Release 1.3,可在UI里设置是否开启历史消息,调整显示历史消息时间 #107
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 | |
- name: Sign | |
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: List files in release directory | |
run: ls -R NLChat/app/build/outputs/apk/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 | |
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 |