File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ * @ enzodjabali
Original file line number Diff line number Diff line change 1+ name : Build and Publish to GitHub Packages on Tag
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*' # Matches any tag; adjust for specific patterns like 'v*'
7+
8+ jobs :
9+ build-and-publish :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : read
13+ packages : write
14+
15+ steps :
16+ # Step 1: Checkout the code
17+ - name : Checkout code
18+ uses : actions/checkout@v3
19+
20+ # Step 2: Log in to GitHub Packages container registry
21+ - name : Log in to GitHub Container Registry
22+ uses : docker/login-action@v2
23+ with :
24+ registry : ghcr.io
25+ username : ${{ github.actor }}
26+ password : ${{ secrets.GITHUB_TOKEN }}
27+
28+ # Step 3: Build and tag the Docker image with version tag and 'latest'
29+ - name : Build and tag Docker image
30+ run : |
31+ TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag
32+ IMAGE=ghcr.io/enzodjabali/iosmb-router
33+ docker build --build-arg VERSION=$TAG -t $IMAGE:$TAG .
34+ docker tag $IMAGE:$TAG $IMAGE:latest
35+
36+ # Step 4: Push the Docker image with version tag
37+ - name : Push Docker image with version tag
38+ run : |
39+ TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag
40+ IMAGE=ghcr.io/enzodjabali/iosmb-router
41+ docker push $IMAGE:$TAG
42+
43+ # Step 5: Push the Docker image with 'latest' tag
44+ - name : Push Docker image with 'latest' tag
45+ run : |
46+ IMAGE=ghcr.io/enzodjabali/iosmb-router
47+ docker push $IMAGE:latest
You can’t perform that action at this time.
0 commit comments