Skip to content

Commit b8d95ea

Browse files
author
Cihad Kocasahan
committed
ci: GitHub Actions workflow for Docker Hub auto-publish on version tags
1 parent b817cba commit b8d95ea

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build & Publish to Docker Hub
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # Trigger on version tags: v0.1.0, v1.0.0, etc.
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Log in to Docker Hub
17+
uses: docker/login-action@v3
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
22+
- name: Extract version tag
23+
id: meta
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: ${{ secrets.DOCKERHUB_USERNAME }}/shadow-svn
27+
tags: |
28+
type=semver,pattern={{version}}
29+
type=raw,value=latest
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: ./app
35+
push: true
36+
tags: ${{ steps.meta.outputs.tags }}
37+
labels: ${{ steps.meta.outputs.labels }}

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ services:
2121
- shadow-sync-net
2222

2323
sync-engine:
24-
build:
24+
# Option A - Pull from Docker Hub (recommended for end users):
25+
# image: cihadkocasahan/shadow-svn:latest
26+
# Option B - Build from source (default, for development):
27+
build:
2528
context: ./app
2629
dockerfile: Dockerfile
2730
container_name: Shadow-Sync-Engine

0 commit comments

Comments
 (0)