Skip to content

Commit 659212e

Browse files
committed
Update pseudoversion
1 parent ef78d5b commit 659212e

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Tags each new commit on the default branch with a Go pseudo-version so downstream
2+
# monorepos can pin any merged commit in go.mod:
3+
#
4+
# require github.com/uber/submitqueue v0.0.0-20250602143045-abcdef123456
5+
#
6+
# Format matches https://go.dev/ref/mod#pseudo-versions (v0.0.0-yyyymmddhhmmss-rev, UTC).
7+
# For branch / preview deploys, use workflow "Tag WIP deploy" (wip/* tags) instead.
8+
name: Tag Go pseudo-version
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
15+
permissions:
16+
contents: write
17+
18+
concurrency:
19+
group: tag-go-pseudoversion-${{ github.repository }}
20+
cancel-in-progress: false
21+
22+
jobs:
23+
tag:
24+
name: Create and push pseudo-version tag
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Compute pseudo-version tag and push
32+
run: |
33+
set -euo pipefail
34+
SHA="${GITHUB_SHA}"
35+
TS="$(git show -s --format=%ct "${SHA}")"
36+
WHEN="$(date -u -d "@${TS}" +%Y%m%d%H%M%S)"
37+
REV="$(git rev-parse --short=12 "${SHA}")"
38+
TAG="v0.0.0-${WHEN}-${REV}"
39+
40+
echo "Computed tag: ${TAG} for ${SHA}"
41+
42+
if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q .; then
43+
echo "Tag ${TAG} already exists on origin; skipping."
44+
exit 0
45+
fi
46+
47+
git tag "${TAG}" "${SHA}"
48+
git push origin "refs/tags/${TAG}"

0 commit comments

Comments
 (0)