Skip to content

Commit c6dfd74

Browse files
authored
chore: create tag for each release and use for publishing (#321)
This follows the same syntax used to stamp the Docker images, so all artifacts should be kept entirely in sync.
1 parent d641698 commit c6dfd74

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/main.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,18 @@
668668
"name": "Calculate shasum",
669669
"run": "shasum -a 256 assets/* > sha256"
670670
},
671+
{
672+
"id": "create_tag",
673+
"name": "Generate tag",
674+
"run": "BUILD_SCM_REVISION=$(git rev-parse --short HEAD)\nBUILD_SCM_TIMESTAMP=$(TZ=UTC date --date \"@$(git show -s --format=%ct HEAD)\" +%Y%m%dT%H%M%SZ)\nRELEASE_TAG=\"${BUILD_SCM_TIMESTAMP}-${BUILD_SCM_REVISION}}\"\ngit tag -a $RELEASE_TAG\ngit push --follow-tags\necho \"release_tag=$RELEASE_TAG\" >> $GITHUB_OUTPUT\n"
675+
},
671676
{
672677
"name": "Create GitHub release and upload artifacts",
673678
"uses": "softprops/action-gh-release@v2",
674679
"with": {
675680
"files": "assets/*\nsha256\n",
676-
"make_latest": true
681+
"make_latest": true,
682+
"tag_name": "${{ steps.create_tag.outputs.release_tag }}"
677683
}
678684
}
679685
]

tools/github_workflows/workflows_template.libsonnet

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,24 @@
165165
name: 'Calculate shasum',
166166
run: 'shasum -a 256 assets/* > sha256',
167167
},
168+
{
169+
name: 'Generate tag',
170+
id: 'create_tag',
171+
run: |||
172+
BUILD_SCM_REVISION=$(git rev-parse --short HEAD)
173+
BUILD_SCM_TIMESTAMP=$(TZ=UTC date --date "@$(git show -s --format=%ct HEAD)" +%Y%m%dT%H%M%SZ)
174+
RELEASE_TAG="${BUILD_SCM_TIMESTAMP}-${BUILD_SCM_REVISION}}"
175+
git tag -a $RELEASE_TAG
176+
git push --follow-tags
177+
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
178+
|||,
179+
},
168180
{
169181
name: 'Create GitHub release and upload artifacts',
170182
uses: 'softprops/action-gh-release@v2',
171183
with: {
172184
make_latest: true,
185+
tag_name: '${{ steps.create_tag.outputs.release_tag }}',
173186
files: |||
174187
assets/*
175188
sha256

0 commit comments

Comments
 (0)