Skip to content

Commit ef02b40

Browse files
bricefclaude
andcommitted
Support semver tags in CI Docker builds
Trigger CI on tag pushes (v*) in addition to main. When building from a git tag, push the semver version as a Docker tag alongside :latest and :sha. Use fetch-depth: 0 so git describe sees tags. Release flow: git tag v1.0.1 && git push origin v1.0.1 → CI builds with VERSION=v1.0.1 → pushes :latest, :sha, and :v1.0.1 to Docker Hub → Watchtower picks up :latest on the VPS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 47125b7 commit ef02b40

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
tags: ['v*']
67
pull_request:
78
branches: [main]
89

@@ -11,6 +12,8 @@ jobs:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # needed for git describe
1417

1518
- uses: actions/setup-go@v5
1619
with:
@@ -27,9 +30,11 @@ jobs:
2730
docker:
2831
needs: check
2932
runs-on: ubuntu-latest
30-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
33+
if: github.event_name == 'push'
3134
steps:
3235
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
3338

3439
- uses: extractions/setup-just@v2
3540

@@ -49,3 +54,8 @@ jobs:
4954
just docker-build-cached
5055
just docker-push latest
5156
just docker-push ${{ github.sha }}
57+
58+
# If this is a tag push, also push the semver tag.
59+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
60+
just docker-push "${{ github.ref_name }}"
61+
fi

0 commit comments

Comments
 (0)