Skip to content

Commit 472719d

Browse files
authored
ci: do not upload artifacts for pre-releases (#2143)
1 parent b7b54d5 commit 472719d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/release.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ jobs:
8282
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
8383
env:
8484
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
85-
run: | # Note: MSI_VERSION requires . as a separator, so replace "-" in the tag with ".".
85+
run: | # Note: MSI_VERSION requires . as a separator and admits only numbers, so replace "-[a-z]*" in the tag with ".".
8686
VERSION=${GITHUB_REF#refs/tags/v}
87-
MSI_VERSION=${VERSION//-/.}
87+
MSI_VERSION=${VERSION//-[a-z]*./.}
8888
make dist VERSION=$VERSION MSI_VERSION=$MSI_VERSION
8989
echo "VERSION=${VERSION}" >> $GITHUB_ENV
9090
shell: bash
@@ -181,6 +181,12 @@ jobs:
181181
ls dist
182182
tag="${GITHUB_REF#refs/tags/}"
183183
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
184-
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./dist/*
184+
if [[ $VERSION =~ -[a-z]+\. ]]; then
185+
# If it is a pre-release (e.g. it contains `-pre.`) create release notes without artifacts.
186+
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/}
187+
else
188+
# Otherwise upload artifacts.
189+
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./dist/*
190+
fi
185191
env:
186192
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)