From 30ef3c59acbb31cb332c140d6525b3923254b66c Mon Sep 17 00:00:00 2001 From: Gamom <63381531+wifi-left@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:25:56 +0800 Subject: [PATCH 1/4] Try to fix check-update.yml Try to fix check-update.yml --- .github/workflows/check-update.yml | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check-update.yml b/.github/workflows/check-update.yml index 6f600bedd7..73a23fad23 100644 --- a/.github/workflows/check-update.yml +++ b/.github/workflows/check-update.yml @@ -1,7 +1,7 @@ name: Check Update on: - workflow_dispatch: + workflow_dispatch: {} schedule: - cron: '30 * * * *' @@ -9,8 +9,9 @@ permissions: contents: write jobs: - dev-check-update: + stable-check-update: if: ${{ github.repository_owner == 'HMCL-dev' }} + needs: dev-check-update runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -20,7 +21,7 @@ jobs: run: sudo apt-get install -y jq - name: Fetch last version run: | - wget -O ci.json https://ci.huangyuhui.net/job/HMCL/lastSuccessfulBuild/api/json + wget -O ci.json https://ci.huangyuhui.net/job/HMCL-stable/lastSuccessfulBuild/api/json export HMCL_EXE_FILE_NAME=`cat ci.json | jq -M -r '.artifacts[] | select(.fileName | endswith(".exe")) | .fileName'` if [ -z `echo $HMCL_EXE_FILE_NAME | grep -E "^HMCL-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?\.exe\$"` ]; then exit 1; fi @@ -32,9 +33,9 @@ jobs: echo "HMCL_VERSION=$HMCL_VERSION" >> $GITHUB_ENV echo "HMCL_COMMIT_SHA=$HMCL_COMMIT_SHA" >> $GITHUB_ENV - echo "HMCL_TAG_NAME=v$HMCL_VERSION" >> $GITHUB_ENV + echo "HMCL_TAG_NAME=release-$HMCL_VERSION" >> $GITHUB_ENV - name: Check for existing tags - run: if [ -z "$(git tag -l "$HMCL_TAG_NAME")" ]; then echo "continue=true" >> $GITHUB_ENV; fi + run: if ! git tag -l | grep -q "$HMCL_TAG_NAME"; then echo "continue=true" >> $GITHUB_ENV; fi - name: Download artifacts if: ${{ env.continue == 'true' }} run: | @@ -45,13 +46,14 @@ jobs: wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.sh" wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.sh.sha1" env: - DOWNLOAD_BASE_URL: https://ci.huangyuhui.net/job/HMCL/lastSuccessfulBuild/artifact/HMCL/build/libs + DOWNLOAD_BASE_URL: https://ci.huangyuhui.net/job/HMCL-stable/lastSuccessfulBuild/artifact/HMCL/build/libs - name: Generate release note if: ${{ env.continue == 'true' }} run: | + echo " === **Stable Version** === " >> RELEASE_NOTE echo "HMCL v$HMCL_VERSION" >> RELEASE_NOTE echo "" >> RELEASE_NOTE - echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/dev.html" >> RELEASE_NOTE + echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/stable.html" >> RELEASE_NOTE echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE - name: Create release if: ${{ env.continue == 'true' }} @@ -68,9 +70,9 @@ jobs: target_commitish: ${{ env.HMCL_COMMIT_SHA }} name: ${{ env.HMCL_TAG_NAME }} tag_name: ${{ env.HMCL_TAG_NAME }} - stable-check-update: + token: ${{ secrets.GITHUB_TOKEN }} + dev-check-update: if: ${{ github.repository_owner == 'HMCL-dev' }} - needs: dev-check-update runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -80,7 +82,7 @@ jobs: run: sudo apt-get install -y jq - name: Fetch last version run: | - wget -O ci.json https://ci.huangyuhui.net/job/HMCL-stable/lastSuccessfulBuild/api/json + wget -O ci.json https://ci.huangyuhui.net/job/HMCL/lastSuccessfulBuild/api/json export HMCL_EXE_FILE_NAME=`cat ci.json | jq -M -r '.artifacts[] | select(.fileName | endswith(".exe")) | .fileName'` if [ -z `echo $HMCL_EXE_FILE_NAME | grep -E "^HMCL-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?\.exe\$"` ]; then exit 1; fi @@ -92,9 +94,9 @@ jobs: echo "HMCL_VERSION=$HMCL_VERSION" >> $GITHUB_ENV echo "HMCL_COMMIT_SHA=$HMCL_COMMIT_SHA" >> $GITHUB_ENV - echo "HMCL_TAG_NAME=release-$HMCL_VERSION" >> $GITHUB_ENV + echo "HMCL_TAG_NAME=v$HMCL_VERSION" >> $GITHUB_ENV - name: Check for existing tags - run: if ! git tag -l | grep -q "$HMCL_TAG_NAME"; then echo "continue=true" >> $GITHUB_ENV; fi + run: if [ -z "$(git tag -l "$HMCL_TAG_NAME")" ]; then echo "continue=true" >> $GITHUB_ENV; fi - name: Download artifacts if: ${{ env.continue == 'true' }} run: | @@ -105,14 +107,13 @@ jobs: wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.sh" wget "$DOWNLOAD_BASE_URL/HMCL-$HMCL_VERSION.sh.sha1" env: - DOWNLOAD_BASE_URL: https://ci.huangyuhui.net/job/HMCL-stable/lastSuccessfulBuild/artifact/HMCL/build/libs + DOWNLOAD_BASE_URL: https://ci.huangyuhui.net/job/HMCL/lastSuccessfulBuild/artifact/HMCL/build/libs - name: Generate release note if: ${{ env.continue == 'true' }} run: | - echo " === **Stable Version** === " >> RELEASE_NOTE echo "HMCL v$HMCL_VERSION" >> RELEASE_NOTE echo "" >> RELEASE_NOTE - echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/stable.html" >> RELEASE_NOTE + echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/dev.html" >> RELEASE_NOTE echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE - name: Create release if: ${{ env.continue == 'true' }} @@ -129,3 +130,4 @@ jobs: target_commitish: ${{ env.HMCL_COMMIT_SHA }} name: ${{ env.HMCL_TAG_NAME }} tag_name: ${{ env.HMCL_TAG_NAME }} + token: ${{ secrets.GITHUB_TOKEN }} From e454410a1aa78ec90ba5c045790ea2396b3d87fc Mon Sep 17 00:00:00 2001 From: Gamom <63381531+wifi-left@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:37:15 +0800 Subject: [PATCH 2/4] Test check-update.yml Test --- .github/workflows/check-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-update.yml b/.github/workflows/check-update.yml index 73a23fad23..ff625b66f4 100644 --- a/.github/workflows/check-update.yml +++ b/.github/workflows/check-update.yml @@ -10,7 +10,7 @@ permissions: jobs: stable-check-update: - if: ${{ github.repository_owner == 'HMCL-dev' }} + # if: ${{ github.repository_owner == 'HMCL-dev' }} needs: dev-check-update runs-on: ubuntu-latest steps: @@ -72,7 +72,7 @@ jobs: tag_name: ${{ env.HMCL_TAG_NAME }} token: ${{ secrets.GITHUB_TOKEN }} dev-check-update: - if: ${{ github.repository_owner == 'HMCL-dev' }} + # if: ${{ github.repository_owner == 'HMCL-dev' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 10a47de3bd9f3d5f60b8825efaefff44ea63b638 Mon Sep 17 00:00:00 2001 From: Gamom <63381531+wifi-left@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:39:10 +0800 Subject: [PATCH 3/4] Update check-update.yml --- .github/workflows/check-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-update.yml b/.github/workflows/check-update.yml index ff625b66f4..73a23fad23 100644 --- a/.github/workflows/check-update.yml +++ b/.github/workflows/check-update.yml @@ -10,7 +10,7 @@ permissions: jobs: stable-check-update: - # if: ${{ github.repository_owner == 'HMCL-dev' }} + if: ${{ github.repository_owner == 'HMCL-dev' }} needs: dev-check-update runs-on: ubuntu-latest steps: @@ -72,7 +72,7 @@ jobs: tag_name: ${{ env.HMCL_TAG_NAME }} token: ${{ secrets.GITHUB_TOKEN }} dev-check-update: - # if: ${{ github.repository_owner == 'HMCL-dev' }} + if: ${{ github.repository_owner == 'HMCL-dev' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From c175be5bec5b5982a506bef39044cd6c091ed9de Mon Sep 17 00:00:00 2001 From: Gamom <63381531+wifi-left@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:57:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E4=BB=A5=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20check-update.ym?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更换框架以尝试修复 check-update.yml --- .github/workflows/check-update.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/check-update.yml b/.github/workflows/check-update.yml index 73a23fad23..183bdb60eb 100644 --- a/.github/workflows/check-update.yml +++ b/.github/workflows/check-update.yml @@ -11,7 +11,6 @@ permissions: jobs: stable-check-update: if: ${{ github.repository_owner == 'HMCL-dev' }} - needs: dev-check-update runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -57,9 +56,8 @@ jobs: echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE - name: Create release if: ${{ env.continue == 'true' }} - uses: softprops/action-gh-release@v1 + uses: marvinpinto/action-automatic-releases@v1.2.1 with: - body_path: RELEASE_NOTE files: | HMCL-${{ env.HMCL_VERSION }}.exe HMCL-${{ env.HMCL_VERSION }}.exe.sha1 @@ -67,12 +65,12 @@ jobs: HMCL-${{ env.HMCL_VERSION }}.jar.sha1 HMCL-${{ env.HMCL_VERSION }}.sh HMCL-${{ env.HMCL_VERSION }}.sh.sha1 - target_commitish: ${{ env.HMCL_COMMIT_SHA }} - name: ${{ env.HMCL_TAG_NAME }} - tag_name: ${{ env.HMCL_TAG_NAME }} - token: ${{ secrets.GITHUB_TOKEN }} + title: ${{ env.HMCL_TAG_NAME }} + automatic_release_tag: ${{ env.HMCL_TAG_NAME }} + repo_token: ${{ secrets.GITHUB_TOKEN }} dev-check-update: if: ${{ github.repository_owner == 'HMCL-dev' }} + needs: stable-check-update runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -117,17 +115,16 @@ jobs: echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE - name: Create release if: ${{ env.continue == 'true' }} - uses: softprops/action-gh-release@v1 + uses: marvinpinto/action-automatic-releases@v1.2.1 with: - body_path: RELEASE_NOTE files: | + RELEASE_NOTE HMCL-${{ env.HMCL_VERSION }}.exe HMCL-${{ env.HMCL_VERSION }}.exe.sha1 HMCL-${{ env.HMCL_VERSION }}.jar HMCL-${{ env.HMCL_VERSION }}.jar.sha1 HMCL-${{ env.HMCL_VERSION }}.sh HMCL-${{ env.HMCL_VERSION }}.sh.sha1 - target_commitish: ${{ env.HMCL_COMMIT_SHA }} - name: ${{ env.HMCL_TAG_NAME }} - tag_name: ${{ env.HMCL_TAG_NAME }} - token: ${{ secrets.GITHUB_TOKEN }} + title: ${{ env.HMCL_TAG_NAME }} + automatic_release_tag: ${{ env.HMCL_TAG_NAME }} + repo_token: ${{ secrets.GITHUB_TOKEN }}