File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Push Docker Image
2+
3+ on :
4+ push :
5+ branches : [ "v2" ]
6+ tags : [ 'v*.*.*' ]
7+ pull_request :
8+ branches : [ "v2" ]
9+
10+ env :
11+ REGISTRY : ghcr.io
12+ IMAGE_NAME : ${{ github.repository }}
13+
14+
15+ jobs :
16+ build :
17+
18+ runs-on : ubuntu-latest
19+ permissions :
20+ contents : read
21+ packages : write
22+ id-token : write
23+
24+ steps :
25+ - name : Checkout repository
26+ uses : actions/checkout@v4
27+
28+ - name : Set up Docker Buildx
29+ uses : docker/setup-buildx-action@v3
30+
31+ - name : Log into registry ${{ env.REGISTRY }}
32+ if : github.event_name != 'pull_request'
33+ uses : docker/login-action@v3
34+ with :
35+ registry : ${{ env.REGISTRY }}
36+ username : ${{ github.actor }}
37+ password : ${{ secrets.GITHUB_TOKEN }}
38+
39+ - name : Extract Docker metadata
40+ id : meta
41+ uses : docker/metadata-action@v5
42+ with :
43+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
45+ # Build and push Docker image with Buildx (don't push on PR)
46+ - name : Build and push Docker image
47+ id : build-and-push
48+ uses : docker/build-push-action@v5
49+ with :
50+ context : .
51+ push : ${{ github.event_name != 'pull_request' }}
52+ tags : ${{ steps.meta.outputs.tags }}
53+ labels : ${{ steps.meta.outputs.labels }}
54+ cache-from : type=gha
55+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments