Skip to content

Commit e46dec8

Browse files
authored
Merge pull request #712 from frstrtr/ci-steward/release-draft-idempotent
release.yml: idempotent draft assembly (no more duplicate v0.2.1 drafts) + surface missing setup.exe
2 parents 73bb7bf + 91755d5 commit e46dec8

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,10 @@ jobs:
613613
with:
614614
name: pkg-windows-setup-${{ matrix.coin }}
615615
path: c2pool-*-windows-x86_64-setup.exe
616-
if-no-files-found: ignore
616+
# warn (not ignore): if ISCC ran but produced no .exe, surface it as a
617+
# run annotation instead of silently shipping a draft with no installer.
618+
# Still non-fatal — the portable .zip remains the must-have deliverable.
619+
if-no-files-found: warn
617620

618621
# ════════════════════════════════════════════════════════════════════════════
619622
# Aggregate: single SHA256SUMS over every produced package; on tags,
@@ -649,14 +652,27 @@ jobs:
649652
name: SHA256SUMS
650653
path: dist/SHA256SUMS
651654

652-
- name: Create draft release
655+
# Idempotent draft assembly: a v-tag draft may already exist from a prior
656+
# re-run of this job. gh release create is NOT idempotent -- it spawns a
657+
# SECOND draft with the same tag_name, so repeated runs pile up duplicate
658+
# "vX.Y.Z" drafts. Refresh ONE canonical draft instead: upload --clobber
659+
# if the release exists, else create it fresh.
660+
- name: Assemble draft release (idempotent)
653661
if: startsWith(github.ref, 'refs/tags/v')
654662
env:
655663
GH_TOKEN: ${{ github.token }}
656664
run: |
657-
gh release create "${GITHUB_REF_NAME}" \
658-
--repo "${{ github.repository }}" \
659-
--draft \
660-
--title "c2pool ${GITHUB_REF_NAME}" \
661-
--notes "Draft assembled by release.yml — operator reviews and publishes manually." \
662-
dist/*
665+
TAG="${GITHUB_REF_NAME}"
666+
REPO="${{ github.repository }}"
667+
if gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
668+
echo "Draft $TAG already exists -- refreshing assets in place (--clobber)."
669+
gh release upload "$TAG" dist/* --clobber --repo "$REPO"
670+
else
671+
echo "No release for $TAG -- creating fresh draft."
672+
gh release create "$TAG" \
673+
--repo "$REPO" \
674+
--draft \
675+
--title "c2pool $TAG" \
676+
--notes "Draft assembled by release.yml -- operator reviews and publishes manually." \
677+
dist/*
678+
fi

0 commit comments

Comments
 (0)