Skip to content

Commit b5fb8da

Browse files
committed
Add replace option to release workflow
New boolean input allows re-releasing the same version by deleting the existing release and force-updating the tag before rebuild.
1 parent 9da902e commit b5fb8da

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
description: "Release notes (optional — auto-generated from commits if empty)"
1212
required: false
1313
type: string
14+
replace:
15+
description: "Replace existing release if it exists"
16+
required: false
17+
type: boolean
18+
default: false
1419

1520
permissions:
1621
contents: write
@@ -128,10 +133,16 @@ jobs:
128133
- name: Generate checksums
129134
run: sha256sum *.tar.gz *.zip > checksums.txt
130135

136+
- name: Delete existing release
137+
if: ${{ inputs.replace }}
138+
run: gh release delete "${{ inputs.version }}" --yes --cleanup-tag || true
139+
env:
140+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
131142
- name: Create tag
132143
run: |
133-
git tag ${{ inputs.version }}
134-
git push origin ${{ inputs.version }}
144+
git tag -f ${{ inputs.version }}
145+
git push origin ${{ inputs.version }} --force
135146
136147
- uses: softprops/action-gh-release@v2
137148
with:

0 commit comments

Comments
 (0)