1- # .github/workflows/ci.yml
21name : CI (Auto-tag + Build & Push Docker on SemVer)
32
43on :
1312 DOCKERFILE : ./Dockerfile
1413
1514permissions :
16- contents : write # needed to create/ push git tags
15+ contents : write # <-- gives GITHUB_TOKEN push access to create tags
1716
1817jobs :
19- # ------------------------------------------------------------
20- # 1️⃣ MAIN BRANCH: only auto-tag if '#release' is in commit msg
21- # ------------------------------------------------------------
18+ # 1️⃣ main branch: bump + tag if '#release' present
2219 auto-release :
2320 if : ${{ github.ref == 'refs/heads/main' && contains(join(github.event.commits.*.message, ' '), '#release') }}
2421 runs-on : ubuntu-latest
2522 steps :
26- - name : Checkout full history
27- uses : actions/checkout@v4
23+ - uses : actions/checkout@v4
2824 with :
2925 fetch-depth : 0
3026
@@ -42,21 +38,14 @@ jobs:
4238 git tag -a "$NEW_TAG" -m "release $NEW_TAG"
4339 git push origin "$NEW_TAG"
4440
45- # ------------------------------------------------------------
46- # 2️⃣ TAG EVENT: build & push image ONLY for SemVer tags
47- # ------------------------------------------------------------
41+ # 2️⃣ tag events: build + push ONLY semver tags
4842 build-and-push :
4943 if : startsWith(github.ref, 'refs/tags/')
5044 runs-on : ubuntu-latest
5145 steps :
52- - name : Checkout
53- uses : actions/checkout@v4
54-
55- - name : Set up QEMU
56- uses : docker/setup-qemu-action@v3
57-
58- - name : Set up Buildx
59- uses : docker/setup-buildx-action@v3
46+ - uses : actions/checkout@v4
47+ - uses : docker/setup-qemu-action@v3
48+ - uses : docker/setup-buildx-action@v3
6049
6150 - name : Log in to Docker Hub
6251 uses : docker/login-action@v3
0 commit comments