File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ # Builds and pushes the Docker image to GitHub Container Registry
2+ name : Publish Docker Image
3+
4+ on :
5+ push :
6+ branches : [main]
7+ workflow_dispatch :
8+
9+ env :
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build-and-push :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Log in to the Container registry
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ${{ env.REGISTRY }}
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Extract metadata (tags, labels) for Docker
32+ id : meta
33+ uses : docker/metadata-action@v5
34+ with :
35+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+ tags : |
37+ type=raw,value=latest
38+ type=sha,prefix=
39+
40+ - name : Build and push Docker image
41+ uses : docker/build-push-action@v5
42+ with :
43+ context : .
44+ push : true
45+ tags : ${{ steps.meta.outputs.tags }}
46+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments