Skip to content

Commit c2eb0f5

Browse files
Mutable Release Tag (AST-151094) (#1491)
* Tag made local before publish
1 parent e8e0b50 commit c2eb0f5

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
git config user.name "${GITHUB_ACTOR}"
105105
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
106106
git tag -a "${tag}" -m "${message}"
107-
git push origin "${tag}"
107+
# tag stays local — pushed at the end of the job, after the release is fully built
108108
- name: Build GoReleaser Args
109109
run: |
110110
args='release --clean --debug --timeout 90m'
@@ -141,6 +141,36 @@ jobs:
141141
env:
142142
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
143143

144+
- name: Create GitHub Release
145+
env:
146+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
run: |
148+
set -euo pipefail
149+
shopt -s failglob
150+
151+
common=(
152+
"${{ inputs.tag }}"
153+
dist/*.tar.gz dist/*.zip dist/*checksums*
154+
--target "${{ github.sha }}"
155+
--title "Checkmarx One CLI ${{ inputs.tag }}"
156+
--generate-notes
157+
--draft
158+
)
159+
160+
if [ "${{ inputs.dev }}" = "true" ]; then
161+
gh release create "${common[@]}" --prerelease
162+
gh release edit "${{ inputs.tag }}" --draft=false
163+
else
164+
gh release create "${common[@]}"
165+
gh release edit "${{ inputs.tag }}" --draft=false --latest
166+
fi
167+
168+
- name: Cleanup draft release on failure
169+
if: failure()
170+
env:
171+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
run: gh release delete "${{ inputs.tag }}" --cleanup-tag --yes || true
173+
144174
notify:
145175
name: Update Teams & JIRA About New Release
146176
if: inputs.dev == false && 1 == 0
@@ -163,3 +193,4 @@ jobs:
163193
with:
164194
cli_version: ${{ inputs.tag }}
165195
secrets: inherit
196+

.goreleaser-dev.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ project_name: ast-cli
33
release:
44
prerelease: true
55
name_template: 'Checkmarx One CLI {{.Version}}'
6+
disable: true
67

78
builds:
89
- main: ./cmd/main.go
@@ -83,7 +84,7 @@ universal_binaries:
8384
replace: true
8485
name_template: "cx"
8586
hooks:
86-
post: bash -c 'envsubst < gonMac.hcl > /tmp/gonMac.hcl && gon /tmp/gonMac.hcl'
87+
post: bash -c 'envsubst < gonMac.hcl > /tmp/gonMac.hcl && gon /tmp/gonMac.hcl || (echo "gon failed, force-detaching DMG volume..."; hdiutil detach /Volumes/cx -force 2>/dev/null || true; gon /tmp/gonMac.hcl)'
8788

8889
blobs:
8990
- provider: s3
@@ -96,3 +97,4 @@ blobs:
9697

9798
changelog:
9899
use: github-native
100+

.goreleaser.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ project_name: ast-cli
22

33
release:
44
name_template: 'Checkmarx One CLI {{.Version}}'
5+
disable: true
56

67
builds:
78
- main: ./cmd/main.go
@@ -108,7 +109,7 @@ universal_binaries:
108109
replace: true
109110
name_template: "cx"
110111
hooks:
111-
post: bash -c 'envsubst < gonMac.hcl > /tmp/gonMac.hcl && gon /tmp/gonMac.hcl'
112+
post: bash -c 'envsubst < gonMac.hcl > /tmp/gonMac.hcl && gon /tmp/gonMac.hcl || (echo "gon failed, force-detaching DMG volume..."; hdiutil detach /Volumes/cx -force 2>/dev/null || true; gon /tmp/gonMac.hcl)'
112113

113114
# brews:
114115
# - skip: true
@@ -155,3 +156,4 @@ blobs:
155156

156157
changelog:
157158
use: github-native
159+

0 commit comments

Comments
 (0)