@@ -2,7 +2,14 @@ name: Deploy
22
33on :
44 push :
5- branches : [ "main" ]
5+ branches : ["main"]
6+ tags :
7+ - workshop-bot-v*
8+ pull_request :
9+
10+ env :
11+ REGISTRY : ghcr.io
12+ IMAGE_NAME : ${{ github.repository }}
613
714jobs :
815
@@ -14,15 +21,37 @@ jobs:
1421
1522 steps :
1623 - uses : actions/checkout@v3
17- - uses : satackey/action-docker-layer-caching@v0.0.11
1824 continue-on-error : true
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v2
27+
1928 - name : Log in to the Container registry
2029 uses : docker/login-action@v2
2130 with :
2231 registry : ghcr.io
2332 username : ${{ github.actor }}
2433 password : ${{ secrets.GITHUB_TOKEN }}
25- - name : Build the Docker images
26- run : DOCKER_BUILDKIT=1 docker build . -t ghcr.io/ssps-kb/workshop-bot:latest
27- - name : Deploy the Docker images
28- run : DOCKER_BUILDKIT=1 docker push ghcr.io/ssps-kb/workshop-bot:latest
34+
35+ - name : Extract Docker metadata
36+ id : meta
37+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
38+ with :
39+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+ flavor : |
41+ latest=false
42+ tags :
43+ type=ref,value=latest,event=tag
44+ type=semver,pattern=workshop-bot-v{{version}},value={{version}}
45+ type=ref,event=branch
46+ type=ref,event=pr
47+ type=sha
48+
49+ - name : Build and push
50+ uses : docker/build-push-action@v4
51+ with :
52+ context : .
53+ push : true
54+ tags : ${{ steps.meta.outputs.tags }}
55+ labels : ${{ steps.meta.outputs.labels }}
56+ cache-from : type=gha
57+ cache-to : type=gha,mode=max
0 commit comments