Skip to content

Commit bf658af

Browse files
committed
fix(ci): fetch tags, download artifacts and robust fallback GitHub release
1 parent 5e1d51c commit bf658af

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

‎.github/workflows/ci-cd.yml‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ jobs:
269269
- uses: actions/checkout@v4
270270
with:
271271
fetch-depth: 0
272+
fetch-tags: true
272273
token: ${{ secrets.GITHUB_TOKEN }}
273274

274275
- name: Set up Python
@@ -302,6 +303,13 @@ jobs:
302303
echo "=== Actual Release ==="
303304
semantic-release publish
304305
306+
- name: Download build artifacts for release (Fallback)
307+
if: success()
308+
uses: actions/download-artifact@v4
309+
with:
310+
name: python-package
311+
path: dist/
312+
305313
- name: Create GitHub Release (Fallback)
306314
if: success()
307315
env:
@@ -311,11 +319,19 @@ jobs:
311319
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
312320
if [ -n "$LATEST_TAG" ] && [ "$LATEST_TAG" != "v1.1.0" ]; then
313321
echo "Creating GitHub Release for $LATEST_TAG"
314-
gh release create "$LATEST_TAG" \
315-
--title "$LATEST_TAG" \
316-
--notes "Automatisches Release erstellt durch semantic-release" \
317-
--generate-notes \
318-
dist/* || echo "Release creation failed or already exists"
322+
# Falls es Artefakte gibt, anhängen; ansonsten nur Release erstellen
323+
if compgen -G "dist/*" > /dev/null; then
324+
gh release create "$LATEST_TAG" \
325+
--title "$LATEST_TAG" \
326+
--notes "Automatisches Release erstellt durch semantic-release" \
327+
--generate-notes \
328+
dist/* || echo "Release creation failed or already exists"
329+
else
330+
gh release create "$LATEST_TAG" \
331+
--title "$LATEST_TAG" \
332+
--notes "Automatisches Release erstellt durch semantic-release" \
333+
--generate-notes || echo "Release creation failed or already exists"
334+
fi
319335
else
320336
echo "No new tag found, skipping GitHub Release creation"
321337
fi

0 commit comments

Comments
 (0)