From 472719d8aa39062b5c6dfcaf7a09766fd8d69e17 Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Sat, 9 Mar 2024 14:28:20 +0800 Subject: [PATCH] ci: do not upload artifacts for pre-releases (#2143) --- .github/workflows/release.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b8c3b56ef5..55cf1a2c45 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -82,9 +82,9 @@ jobs: if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') env: WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }} - run: | # Note: MSI_VERSION requires . as a separator, so replace "-" in the tag with ".". + run: | # Note: MSI_VERSION requires . as a separator and admits only numbers, so replace "-[a-z]*" in the tag with ".". VERSION=${GITHUB_REF#refs/tags/v} - MSI_VERSION=${VERSION//-/.} + MSI_VERSION=${VERSION//-[a-z]*./.} make dist VERSION=$VERSION MSI_VERSION=$MSI_VERSION echo "VERSION=${VERSION}" >> $GITHUB_ENV shell: bash @@ -181,6 +181,12 @@ jobs: ls dist tag="${GITHUB_REF#refs/tags/}" ./.github/workflows/release_notes.sh ${tag} > release-notes.txt - gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./dist/* + if [[ $VERSION =~ -[a-z]+\. ]]; then + # If it is a pre-release (e.g. it contains `-pre.`) create release notes without artifacts. + gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} + else + # Otherwise upload artifacts. + gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./dist/* + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}