File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image on Tag
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *'
7+
8+ jobs :
9+ build-and-push :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout Repository
14+ uses : actions/checkout@v4
15+
16+ - name : Log in to GitHub Container Registry
17+ uses : docker/login-action@v2
18+ with :
19+ registry : ghcr.io
20+ username : ${{ github.repository_owner }}
21+ password : ${{ secrets.GITHUB_TOKEN }}
22+
23+ - name : Extract tag name
24+ id : vars
25+ run : echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
26+
27+ - name : Build Docker image
28+ run : |
29+ docker build -f docker/Dockerfile -t ghcr.io/${{ github.repository_owner }}/maltrail:${{ env.TAG }} .
30+
31+ - name : Push Docker image
32+ run : |
33+ docker push ghcr.io/${{ github.repository_owner }}/maltrail:${{ env.TAG }}
34+
35+ - name : Optional: Also tag latest
36+ run : |
37+ docker tag ghcr.io/${{ github.repository_owner }}/maltrail:${{ env.TAG }} ghcr.io/${{ github.repository_owner }}/maltrail:latest
38+ docker push ghcr.io/${{ github.repository_owner }}/maltrail:latest
You can’t perform that action at this time.
0 commit comments