Skip to content

Commit 3a4f1e7

Browse files
authored
feat: enhance release automation by adding draft check (#3026)
* feat: enhance release automation by adding draft check and conditional artifact download Signed-off-by: John Bair <john.bair@swirldslabs.com> * feat: add release tracking issue creation step to release automation workflow Signed-off-by: John Bair <john.bair@swirldslabs.com> --------- Signed-off-by: John Bair <john.bair@swirldslabs.com>
1 parent 563e576 commit 3a4f1e7

1 file changed

Lines changed: 46 additions & 7 deletions

File tree

.github/workflows/release-automation.yaml

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ jobs:
382382
retention-days: 5
383383

384384
# ----------------------------
385-
# Close the milestone, publish the GitHub release, and attach macOS artifacts.
385+
# Close the milestone, attach macOS artifacts, and publish the GitHub release.
386386
# ----------------------------
387387
github_release:
388388
name: Publish GitHub Release
@@ -412,6 +412,7 @@ jobs:
412412

413413
- name: Close the Milestone
414414
if: ${{ needs.prepare.outputs.prerelease == '' }}
415+
continue-on-error: true
415416
uses: step-security/close-milestone@d6e3b63e31f1f869bd3d0403f8cdc1a68f59ab4a # v2.2.2
416417
with:
417418
milestone_name: v${{ needs.prepare.outputs.release }}
@@ -436,12 +437,6 @@ jobs:
436437
echo "$RELEASE_BODY" >> $GITHUB_ENV
437438
echo "EOF" >> $GITHUB_ENV
438439
439-
- name: Download macOS Artifacts
440-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
441-
with:
442-
name: macos-artifacts-${{ needs.prepare.outputs.version }}
443-
path: macos-artifacts
444-
445440
- name: Create GitHub Release
446441
uses: step-security/release-action@a0d8e0f90f554c15366ca2c9046bf4090d24adbe # v1.21.0
447442
with:
@@ -454,7 +449,29 @@ jobs:
454449
tag: ${{ env.RELEASE_TAG }}
455450
token: ${{ secrets.GITHUB_TOKEN }}
456451

452+
- name: Check Release Is Draft
453+
id: release_state
454+
env:
455+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
456+
run: |
457+
IS_DRAFT=$(gh release view "$RELEASE_TAG" \
458+
--repo ${{ github.repository }} \
459+
--json isDraft \
460+
--jq '.isDraft')
461+
echo "is_draft=$IS_DRAFT" >> $GITHUB_OUTPUT
462+
if [[ "$IS_DRAFT" != "true" ]]; then
463+
echo "Release is already published — skipping artifact upload"
464+
fi
465+
466+
- name: Download macOS Artifacts
467+
if: ${{ steps.release_state.outputs.is_draft == 'true' }}
468+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
469+
with:
470+
name: macos-artifacts-${{ needs.prepare.outputs.version }}
471+
path: macos-artifacts
472+
457473
- name: Upload macOS Artifacts to Release
474+
if: ${{ steps.release_state.outputs.is_draft == 'true' }}
458475
env:
459476
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
460477
run: |
@@ -471,6 +488,28 @@ jobs:
471488
--prerelease \
472489
--repo ${{ github.repository }}
473490
491+
492+
# ----------------------------
493+
# Create or update the release tracking issue. Runs in parallel with
494+
# create_snapshot_pr so a flaky GitHub API call cannot block the snapshot PR.
495+
# ----------------------------
496+
create_tracking_issue:
497+
name: Create or Update Release Tracking Issue
498+
runs-on: transaction-tools-linux-medium
499+
needs: [prepare, cut_release, github_release]
500+
501+
steps:
502+
- name: Harden Runner
503+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
504+
with:
505+
egress-policy: audit
506+
507+
- name: Checkout Repository
508+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
509+
with:
510+
ref: ${{ needs.prepare.outputs.release_branch }}
511+
token: ${{ secrets.HEDERA_BOT_TOKEN }}
512+
474513
- name: Create or Update Release Tracking Issue
475514
env:
476515
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)