@@ -10,64 +10,45 @@ jobs:
1010 contents : write
1111
1212 steps :
13- - name : Checkout source code
14- uses : actions/checkout@v4
13+ - name : Checkout Source Code
14+ uses : actions/checkout@v6
1515 with :
1616 fetch-depth : 0
1717
18- - uses : actions/download-artifact@v4
19- with :
20- name : outputs
21- path : ${{ github.workspace }}/outputs/
22-
23- - name : Extract APK
24- id : apk-info
18+ - name : Download APK
19+ id : apk
2520 shell : bash
2621 run : |
27- APP_VERSION_CODE=$(cat $GITHUB_WORKSPACE/outputs/version-code)
28- APP_VERSION_NAME=$(cat $GITHUB_WORKSPACE/outputs/version-name)
29- APK_FILENAME="FzuHelper_${APP_VERSION_NAME}(${APP_VERSION_CODE}).apk"
30- echo "apk_filename=$APK_FILENAME" >> "$GITHUB_OUTPUT"
31- mv $GITHUB_WORKSPACE/outputs/apk/release/app-arm64-v8a-release.apk $APK_FILENAME
32-
33- - name : Get version info
34- id : version-info
35- run : |
36- CURRENT_VERSION=${GITHUB_REF_NAME}
37- echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
22+ mkdir -p "$GITHUB_WORKSPACE/outputs/apk/release"
23+ gh release download alpha --pattern "FzuHelper_*.apk" --dir "$GITHUB_WORKSPACE/outputs/apk/release"
3824
39- git fetch --tags --force
40- ALL_TAGS=$(git tag -l "*.*.*" --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')
25+ APK_PATH=$(ls "$GITHUB_WORKSPACE"/outputs/apk/release/FzuHelper_*.apk | head -n 1)
26+ if [[ -z "$APK_PATH" ]]; then
27+ echo "Error: APK file not found in the release assets."
28+ exit 1
29+ fi
4130
42- PREV_TAG=$(echo "$ALL_TAGS" | grep -B1 "$GITHUB_REF_NAME" | head -n1)
31+ echo "APK_PATH=$APK_PATH" >> "$GITHUB_OUTPUT"
32+ env :
33+ GH_TOKEN : ${{ github.token }}
4334
44- [ -z "$PREV_TAG" ] && PREV_TAG=$(git rev-list --max-parents=0 HEAD)
45-
46- echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
47-
48- - name : Generate changelog
49- id : changelog
35+ - name : Generate Release Info
36+ id : info
5037 run : |
51- CHANGELOG=$(git log --pretty=format:"- [%%h] %%s (by %%an)" \
52- --date=short \
53- --no-merges \
54- ${{ steps.version-info.outputs.prev_tag }}..HEAD | sed 's/%/%%/g')
55-
56- COMPARE_URL="https://github.com/${{ github.repository }}/compare/${{ steps.version-info.outputs.prev_tag }}...${{ github.ref_name }}"
38+ CURRENT_VERSION=${GITHUB_REF_NAME}
39+ echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_OUTPUT
5740
58- echo "changelog<<EOF" >> $GITHUB_OUTPUT
59- echo "## [${{ steps.version-info.outputs.current_version }}]($COMPARE_URL)" >> $GITHUB_OUTPUT
41+ echo "DATE_TIME<<EOF" >> $GITHUB_OUTPUT
6042 echo "### $(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
61- echo "$CHANGELOG" >> $GITHUB_OUTPUT
6243 echo "EOF" >> $GITHUB_OUTPUT
6344
6445 - name : Create GitHub Release
6546 uses : softprops/action-gh-release@v2
6647 with :
6748 tag_name : ${{ github.ref_name }}
68- name : ${{ steps.version- info.outputs.current_version }}
49+ name : ${{ steps.info.outputs.CURRENT_VERSION }}
6950 generate_release_notes : true # 自动生成发布说明
70- body : ${{ steps.changelog .outputs.changelog }}
51+ body : ${{ steps.info .outputs.DATE_TIME }}
7152 make_latest : true
7253 files : |
73- ${{ steps.apk-info .outputs.apk_filename }}
54+ ${{ steps.apk.outputs.APK_PATH }}
0 commit comments