From 81eb11f5c56aa09884fd12b5c56cc2dba411e679 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 6 Sep 2024 21:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-app.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 79ff787..2ba73f5 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -46,6 +46,7 @@ jobs: exit 0 build_AUTO_MAA: runs-on: windows-latest + needs: pre_check steps: - name: Checkout code uses: actions/checkout@v4 @@ -99,8 +100,18 @@ jobs: pattern: AUTO_MAA_* merge-multiple: true path: artifacts + - name: Check if release exists + id: check_if_release_exists + run: | + release_id=$(gh release view $(head -n 1 更新说明.txt) --json id --jq .id) + if [[ -z $release_id ]]; then + echo "::set-output name=release_exists::false" + else + echo "::set-output name=release_exists::true" + fi - name: Create release id: create_release + if: steps.check_if_release_exists.outputs.release_exists == 'false' run: | set -xe shopt -s nullglob @@ -109,6 +120,20 @@ jobs: NOTES_MAIN="$(tail -n +2 更新说明.txt)" NOTES_TAIL="\`\`\`本release通过GitHub Actions自动构建\`\`\`" NOTES="$NOTES_MAIN\n\n$NOTES_TAIL" - gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" artifacts/*.{zip,tar.xz} --update + gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" artifacts/*.{zip,tar.xz} + env: + GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + + - name: Update release + if: steps.check_if_release_exists.outputs.release_exists == 'true' + run: | + set -xe + shopt -s nullglob + NAME="$(head -n 1 更新说明.txt)" + TAGNAME="$(head -n 1 更新说明.txt)" + NOTES_MAIN="$(tail -n +2 更新说明.txt)" + NOTES_TAIL="\`\`\`本release通过GitHub Actions自动构建\`\`\`" + NOTES="$NOTES_MAIN\n\n$NOTES_TAIL" + gh release edit "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" artifacts/*.{zip,tar.xz} env: GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} \ No newline at end of file