11# .github/workflows/docker-publish.yml
2- name : Build and Push Docker Image
3-
2+ name : Mesh Router Image
43on :
54 push :
65 branches : [ main ]
6+ tags : [ 'v*' ] # Trigger on version tags like v1.15, v2.0.1, etc.
77 workflow_dispatch :
8-
98env :
109 REGISTRY : ghcr.io
1110 IMAGE_NAME : ${{ github.repository }}
12-
1311jobs :
1412 build-and-push :
1513 runs-on : ubuntu-latest
1614 permissions :
1715 contents : read
1816 packages : write
19-
2017 steps :
21- - name : Checkout repository with submodules
22- uses : actions/checkout@v4
23- with :
24- fetch-depth : 0
25- submodules : ' true'
26-
27- - name : Free Disk Space
28- uses : jlumbroso/free-disk-space@main
29- with :
30- tool-cache : false
31- android : true
32- dotnet : true
33- haskell : true
34- large-packages : true
35- docker-images : true
36- swap-storage : true
37-
38- - name : Set up Docker Buildx
39- uses : docker/setup-buildx-action@v3
40-
41- - name : Log in to GitHub Container Registry
42- uses : docker/login-action@v3
43- with :
44- registry : ${{ env.REGISTRY }}
45- username : ${{ github.actor }}
46- password : ${{ secrets.GITHUB_TOKEN }}
47-
48- - name : Extract metadata
49- id : meta
50- uses : docker/metadata-action@v5
51- with :
52- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
53- tags : |
54- type=ref,event=branch
55- type=ref,event=pr
56- type=sha
57- type=raw,value=latest,enable={{is_default_branch}}
58-
59- - name : Build and push Docker image
60- uses : docker/build-push-action@v6
61- with :
62- context : .
63- push : true
64- provenance : false
65- platforms : linux/amd64,linux/arm64
66- tags : ${{ steps.meta.outputs.tags }}
67- labels : ${{ steps.meta.outputs.labels }}
18+ - name : Checkout repository with submodules
19+ uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0
22+ submodules : ' true'
23+ - name : Free Disk Space
24+ uses : jlumbroso/free-disk-space@main
25+ with :
26+ tool-cache : false
27+ android : true
28+ dotnet : true
29+ haskell : true
30+ large-packages : true
31+ docker-images : true
32+ swap-storage : true
33+ - name : Set up Docker Buildx
34+ uses : docker/setup-buildx-action@v3
35+ - name : Log in to GitHub Container Registry
36+ uses : docker/login-action@v3
37+ with :
38+ registry : ${{ env.REGISTRY }}
39+ username : ${{ github.actor }}
40+ password : ${{ secrets.GITHUB_TOKEN }}
41+ - name : Extract metadata
42+ id : meta
43+ uses : docker/metadata-action@v5
44+ with :
45+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+ tags : |
47+ type=ref,event=branch
48+ type=ref,event=pr
49+ type=sha
50+ type=semver,pattern={{version}}
51+ type=semver,pattern={{major}}.{{minor}}
52+ type=semver,pattern={{major}}
53+ type=raw,value=latest,enable={{is_default_branch}}
54+ - name : Build and push Docker image
55+ uses : docker/build-push-action@v6
56+ with :
57+ context : .
58+ push : true
59+ provenance : false
60+ platforms : linux/amd64,linux/arm64
61+ tags : ${{ steps.meta.outputs.tags }}
62+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments