From c5695542b2877fa4cc0fb214116480c7aeb6cfbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 21 Dec 2023 09:23:21 +0800 Subject: [PATCH] CI: generate sha256sum for source tarballs Ref: https://github.com/ncipollo/release-action/issues/400 --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 938bc5058..cdbf5e67d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -369,29 +369,45 @@ jobs: permissions: contents: write steps: - - name: download artifacts - uses: actions/download-artifact@v4 - - name: get latest release version id: get_version_release uses: pozetroninc/github-action-get-latest-release@master with: repository: ${{ github.repository }} - - name: generate release-notes + - name: download artifacts + if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release + uses: actions/download-artifact@v4 + + - name: create release + if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release + uses: ncipollo/release-action@v1 + with: + tag: ${{ needs.linux.outputs.ffversion }} + commit: ${{ github.sha }} + artifactErrorsFailBuild: true + artifacts: fastfetch-*/fastfetch-* + body: "Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.linux.outputs.ffversion }}/CHANGELOG.md) for details." + + - name: download source tarballs + if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release run: | + for i in 1 2 3 4 5; do curl -L --remote-name-all --output-dir fastfetch-source --create-dirs https://github.com/${{ github.repository }}/archive/refs/tags/${{ needs.linux.outputs.ffversion }}.{tar.gz,zip} && break || sleep 5; done ls fastfetch-*/* - echo "Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.linux.outputs.ffversion }}/CHANGELOG.md#${{ needs.linux.outputs.ffversion }}) for details." > fastfetch-release-notes.md + + - name: generate release notes + if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release + run: | + echo "Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ needs.linux.outputs.ffversion }}/CHANGELOG.md) for details." > fastfetch-release-notes.md echo -e "\n---\n\n
SHA256SUMs
\n\n\`\`\`" >> fastfetch-release-notes.md sha256sum fastfetch-*/* >> fastfetch-release-notes.md - echo -e "\n\`\`\`\n
" >> fastfetch-release-notes.md + echo -e "\`\`\`\n" >> fastfetch-release-notes.md - - name: create release + - name: update release body if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release uses: ncipollo/release-action@v1 with: tag: ${{ needs.linux.outputs.ffversion }} commit: ${{ github.sha }} bodyFile: fastfetch-release-notes.md - artifactErrorsFailBuild: true - artifacts: fastfetch-*/* + allowUpdates: true