File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ branches : [main]
6+ tags : [v*]
7+ workflow_dispatch :
8+
9+ env :
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Set up Docker Buildx
25+ uses : docker/setup-buildx-action@v3
26+
27+ - name : Log in to GitHub Container Registry
28+ uses : docker/login-action@v3
29+ with :
30+ registry : ${{ env.REGISTRY }}
31+ username : ${{ github.actor }}
32+ password : ${{ secrets.GITHUB_TOKEN }}
33+
34+ - name : Extract Docker metadata
35+ id : meta
36+ uses : docker/metadata-action@v5
37+ with :
38+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+ tags : |
40+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
41+ type=semver,pattern={{version}}
42+ type=semver,pattern={{major}}.{{minor}}
43+ type=sha,format=short
44+
45+ - name : Build and push
46+ uses : docker/build-push-action@v6
47+ with :
48+ push : true
49+ tags : ${{ steps.meta.outputs.tags }}
50+ labels : ${{ steps.meta.outputs.labels }}
51+ cache-from : type=gha
52+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments