File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and push image
2+
3+ on :
4+ pull_request :
5+ paths :
6+ - .github/workflows/push-image.yml
7+ - Dockerfile
8+ push :
9+ branches :
10+ - master
11+ tags :
12+ - ' v*'
13+
14+ permissions :
15+ contents : read
16+ packages : write
17+
18+ env :
19+ REGISTRY : ghcr.io
20+ IMAGE_NAME : ${{ toLower(github.repository) }}
21+
22+ jobs :
23+ docker :
24+ runs-on : ubuntu-latest
25+ steps :
26+ - name : Set up QEMU
27+ uses : docker/setup-qemu-action@v3
28+
29+ - name : Set up Docker Buildx
30+ uses : docker/setup-buildx-action@v3
31+
32+ - name : Login to GHCR
33+ if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
34+ uses : docker/login-action@v3
35+ with :
36+ registry : ${{ env.REGISTRY }}
37+ username : ${{ github.actor }}
38+ password : ${{ secrets.GITHUB_TOKEN }}
39+
40+ - name : Generate image metadata
41+ id : meta
42+ uses : docker/metadata-action@v5
43+ with :
44+ images : |
45+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+ tags : |
47+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
48+ type=ref,event=tag
49+ type=sha
50+
51+ - name : Build and push
52+ uses : docker/build-push-action@v6
53+ with :
54+ context : .
55+ file : ./Dockerfile
56+ push : ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
57+ tags : ${{ steps.meta.outputs.tags }}
58+ labels : ${{ steps.meta.outputs.labels }}
59+ platforms : linux/amd64,linux/arm64
60+ cache-from : type=gha
61+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments