Skip to content

🎉Release 1.3,暂时撤下调试,修改Android CI Release编译链问题 #58

🎉Release 1.3,暂时撤下调试,修改Android CI Release编译链问题

🎉Release 1.3,暂时撤下调试,修改Android CI Release编译链问题 #58

Workflow file for this run

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: Check and Delete Existing Tag
run: |
cd NLChat
if git rev-parse ${{ github.ref_name }} >/dev/null 2>&1; then
git tag -d ${{ github.ref_name }}
git push --delete origin ${{ github.ref_name }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "NLChat_${{ github.ref_name }}.apk"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # 使用 PAT
generateReleaseNotes: true
- name: Bump version and generate changelog
id: version
run: |
cd NLChat
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
npm install -g standard-version
standard-version --release-as ${{ github.ref_name }}
git push --follow-tags origin ${{ github.ref_name }}
- name: Get Commit Message
id: get_commit_message
run:|

Check failure on line 117 in .github/workflows/androidsign.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/androidsign.yml

Invalid workflow file

You have an error in your yaml syntax on line 117
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: Release ${{ github.ref_name }}
body: ${{ env.COMMIT_MESSAGE }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用环境变量
continue-on-error: true