Skip to content

优化

优化 #82

Workflow file for this run

name: Build Test
on:
push:
branches:
- "master"
- "compose"
paths-ignore:
- "**.md"
workflow_dispatch:
jobs:
go-lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.3
cache-dependency-path: ${{ github.workspace }}/tts-server-lib
- name: Build tts-server-lib
run: |
cd tts-server-lib
go install golang.org/x/mobile/cmd/gomobile
gomobile init
go get golang.org/x/mobile/bind
gomobile bind -ldflags "-s -w" -v -androidapi=21
cp -f *.aar $GITHUB_WORKSPACE/app/libs
- uses: actions/[email protected]
with:
name: tts-server-lib
path: tts-server-lib/*.aar
build:
needs: go-lib
strategy:
matrix:
product: [ { name: "App原版", value: app }, { name: "Dev共存版", value: dev } ]
fail-fast: false
runs-on: ubuntu-latest
env:
product: ${{ matrix.product.value }}
product_name: ${{ matrix.product.value }}
outputs_dir: "${{ github.workspace }}/app/build/outputs"
ver_name: ""
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: tts-server-lib
path: ${{ github.workspace }}/app/libs
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
- name: Init Signature
run: |
echo "给apk增加签名"
# not use this output
# echo "KeyStore=yes" >> $GITHUB_OUTPUT
touch local.properties
echo ALIAS_NAME='${{ secrets.ALIAS_NAME }}' >> local.properties
echo ALIAS_PASSWORD='${{ secrets.ALIAS_PASSWORD }}' >> local.properties
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties
echo KEY_PATH='./key.jks' >> local.properties
# 从Secrets读取无换行符Base64解码, 然后保存到到app/key.jks
echo ${{ secrets.KEY_STORE }} | base64 --decode > $GITHUB_WORKSPACE/app/key.jks
- name: Build With Gradle
run: |
echo "开始${{ env.product }}$typeName构建"
chmod +x gradlew
./gradlew assemble${{ env.product }}release --build-cache --parallel --daemon --warning-mode all
- name: Set Version Name
run: |
echo "ver_name=$(grep -m 1 'versionName' ${{ env.outputs_dir }}/apk/${{ env.product }}/release/output-metadata.json | cut -d\" -f4)" >> $GITHUB_ENV
- name: Set apk Name
run: |
echo "修改文件名"
mkdir -p "${{ github.workspace }}/apk/"
cp ${{ env.outputs_dir }}/apk/${{ env.product }}/release/*${{ env.ver_name }}.apk "${{ github.workspace }}/apk/TTS-Server_${{ env.product }}_${{ env.ver_name }}.apk"
- name: Upload APK To Artifact
uses: actions/upload-artifact@v4
with:
name: "TTS-Server_${{ env.product }}_${{ env.ver_name }}"
path: ${{ github.workspace }}/apk/*.apk
lanzou:
needs: [ build ]
runs-on: ubuntu-latest
env:
# 登录蓝奏云后在控制台运行document.cookie
ylogin: ${{ secrets.LANZOU_ID }}
phpdisk_info: ${{ secrets.LANZOU_PSD }}
# 蓝奏云里的文件夹ID
LANZOU_FOLDER_ID: '9494606'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: apk/
- working-directory: apk/
run: mv */*.apk . ;rm -rf */
- name: Upload To Lanzou
continue-on-error: true
run: |
path="$GITHUB_WORKSPACE/apk"
python3 $GITHUB_WORKSPACE/.github/scripts/lzy_web.py "$path" "$LANZOU_FOLDER_ID"
echo "[$(date -u -d '+8 hour' '+%Y.%m.%d %H:%M:%S')] 分享链接: https://miaogongzi.lanzout.com/b01rvtuhg"