Skip to content

🔖 2.0.0-canary.1

🔖 2.0.0-canary.1 #5

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 代码迁出
uses: actions/checkout@v4
- name: 构建Java环境
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: 解码生成 jks
run: echo $KEYSTORE_BASE64 | base64 -di > app/keystore.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
- name: 生成apk
run: chmod +x ./gradlew && ./gradlew assembleRelease
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
- name: 获取版本号
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
- name: 重命名应用
run: |
for file in app/build/outputs/apk/release/app-*.apk; do
if [[ $file =~ app-(.?*)release.apk ]]; then
new_file_name="app/build/outputs/apk/release/mytv-android-${BASH_REMATCH[1]}${{ steps.version.outputs.version }}.apk"
mv "$file" "$new_file_name"
fi
done
- name: Prepare artifacts
run: |
mkdir artifacts
cp app/build/outputs/apk/release/*.apk artifacts/
- name: Upload Release
uses: ncipollo/release-action@v1
with:
name: v${{ steps.version.outputs.version }}
token: ${{ secrets.GIT_TOKEN }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
allowUpdates: true
artifacts: artifacts/*