🔖 v1.2.0 #2
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: 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/release/app-*.apk; do | |
if [[ $file =~ app-(.?*)release.apk ]]; then | |
new_file_name="app/release/mytv-android-${BASH_REMATCH[1]}${{ steps.version.outputs.version }}.apk" | |
mv "$file" "$new_file_name" | |
fi | |
done | |
- 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: app/release/mytv-android-*.apk |