Skip to content

Commit 539fa9b

Browse files
ci: Retag release when editing (#34)
see konveyor/move2kube#371 for details Signed-off-by: Harikrishnan Balagopal <[email protected]>
1 parent 4be4d88 commit 539fa9b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/release.yml

+18-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ jobs:
3232
script: |
3333
const tag = '${{ github.event.inputs.tag }}';
3434
const sha = '${{ steps.get_sha.outputs.sha }}';
35+
36+
let tag_exists = false;
37+
try {
38+
const resp = await github.git.getRef({...context.repo, ref: `tags/${tag}`});
39+
tag_exists = true;
40+
core.info(`the tag ${tag} already exists on ${resp.data.object.type} ${resp.data.object.sha}`);
41+
} catch(err) {
42+
if(err.status !== 404){
43+
throw err;
44+
}
45+
}
46+
if(tag_exists) {
47+
core.info(`deleting the tag ${tag}`);
48+
const resp = await github.git.deleteRef({...context.repo, ref: `tags/${tag}`});
49+
}
50+
51+
core.info(`creating the tag ${tag} on the commit ${sha}`);
3552
// create the tag
3653
github.git.createRef({
3754
...context.repo,
@@ -145,4 +162,4 @@ jobs:
145162
return core.setFailed(`Expected the draft name to begin with [WIP]. Found: ${draft.name}`);
146163
}
147164
const new_name = draft.name.replace(/^\[WIP\] /, '');
148-
await github.repos.updateRelease({...context.repo, release_id: draft.id, name: new_name});
165+
await github.repos.updateRelease({...context.repo, release_id: draft.id, name: new_name, tag_name: draft.tag_name});

0 commit comments

Comments
 (0)