@@ -2,14 +2,14 @@ name: Build and Publish Docker Image
22
33on :
44 push :
5- branches : [ main ]
6- tags : [ 'v*' ]
5+ branches : [main]
6+ tags : ["v*" ]
77 pull_request :
8- branches : [ main ]
8+ branches : [main]
99
1010env :
1111 REGISTRY : docker.io
12- IMAGE_NAME : stewart86/bobby-bot
12+ IMAGE_NAME : stewart86/bobby
1313
1414jobs :
1515 build-and-push :
@@ -19,44 +19,44 @@ jobs:
1919 packages : write
2020
2121 steps :
22- - name : Checkout repository
23- uses : actions/checkout@v4
24-
25- - name : Log in to Docker Hub
26- if : github.event_name != 'pull_request'
27- uses : docker/login-action@v3
28- with :
29- registry : ${{ env.REGISTRY }}
30- username : ${{ secrets.DOCKERHUB_USERNAME }}
31- password : ${{ secrets.DOCKERHUB_TOKEN }}
32-
33- - name : Extract metadata (tags, labels) for Docker
34- id : meta
35- uses : docker/metadata-action@v5
36- with :
37- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38- tags : |
39- type=ref,event=branch
40- type=ref,event=pr
41- type=semver,pattern={{version}}
42- type=semver,pattern={{major}}.{{minor}}
43- type=raw,value=latest,enable={{is_default_branch}}
44-
45- - name : Build and push Docker image
46- uses : docker/build-push-action@v5
47- with :
48- context : .
49- file : ./Dockerfile
50- push : ${{ github.event_name != 'pull_request' }}
51- tags : ${{ steps.meta.outputs.tags }}
52- labels : ${{ steps.meta.outputs.labels }}
53- platforms : linux/amd64
54-
55- - name : Update Docker Hub description
56- if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
57- uses : peter-evans/dockerhub-description@v4
58- with :
59- username : ${{ secrets.DOCKERHUB_USERNAME }}
60- password : ${{ secrets.DOCKERHUB_TOKEN }}
61- repository : ${{ env.IMAGE_NAME }}
62- readme-filepath : ./README.md
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+
25+ - name : Log in to Docker Hub
26+ if : github.event_name != 'pull_request'
27+ uses : docker/login-action@v3
28+ with :
29+ registry : ${{ env.REGISTRY }}
30+ username : ${{ secrets.DOCKERHUB_USERNAME }}
31+ password : ${{ secrets.DOCKERHUB_TOKEN }}
32+
33+ - name : Extract metadata (tags, labels) for Docker
34+ id : meta
35+ uses : docker/metadata-action@v5
36+ with :
37+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+ tags : |
39+ type=ref,event=branch
40+ type=ref,event=pr
41+ type=semver,pattern={{version}}
42+ type=semver,pattern={{major}}.{{minor}}
43+ type=raw,value=latest,enable={{is_default_branch}}
44+
45+ - name : Build and push Docker image
46+ uses : docker/build-push-action@v5
47+ with :
48+ context : .
49+ file : ./Dockerfile
50+ push : ${{ github.event_name != 'pull_request' }}
51+ tags : ${{ steps.meta.outputs.tags }}
52+ labels : ${{ steps.meta.outputs.labels }}
53+ platforms : linux/amd64
54+
55+ - name : Update Docker Hub description
56+ if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
57+ uses : peter-evans/dockerhub-description@v4
58+ with :
59+ username : ${{ secrets.DOCKERHUB_USERNAME }}
60+ password : ${{ secrets.DOCKERHUB_TOKEN }}
61+ repository : ${{ env.IMAGE_NAME }}
62+ readme-filepath : ./README.md
0 commit comments