@@ -2,40 +2,35 @@ name: Build Docker image
22
33on :
44 push :
5- branches :
6- - develop
7- - main
85 tags :
9- - v*
10- workflow_dispatch :
6+ - " v*.*.*"
117
128jobs :
13- build :
9+ build_deploy :
10+ name : Build and Deploy
1411 runs-on : ubuntu-latest
15- env :
16- GIT_REF : ${{ github.head_ref || github.ref_name }} # ref_name to get tags/branches
1712 permissions :
1813 contents : read
1914 packages : write
2015 steps :
2116 - name : Checkout
2217 uses : actions/checkout@v4
2318
19+ - name : Docker meta
20+ id : meta
21+ uses : docker/metadata-action@v5
22+ with :
23+ images : ghcr.io/${{ github.repository }}
24+ tags : |
25+ type=semver,pattern={{version}}
26+ type=semver,pattern={{major}}.{{minor}}
27+
2428 - name : Set up QEMU
2529 uses : docker/setup-qemu-action@v3
2630
2731 - name : Set up Docker Buildx
2832 uses : docker/setup-buildx-action@v3
2933
30- - name : set docker tag
31- run : |
32- echo "DOCKER_TAG=ghcr.io/atendai/evolution-api:$GIT_REF" >> $GITHUB_ENV
33-
34- - name : replace docker tag if main
35- if : github.ref_name == 'main'
36- run : |
37- echo "DOCKER_TAG=ghcr.io/atendai/evolution-api:latest" >> $GITHUB_ENV
38-
3934 - name : Login to GitHub Container Registry
4035 uses : docker/login-action@v3
4136 with :
@@ -44,10 +39,13 @@ jobs:
4439 password : ${{ secrets.GITHUB_TOKEN }}
4540
4641 - name : Build and push
47- uses : docker/build-push-action@v2
42+ id : docker_build
43+ uses : docker/build-push-action@v5
4844 with :
49- context : .
50- file : ./Dockerfile
5145 platforms : linux/amd64,linux/arm64
5246 push : true
53- tags : ${{ env.DOCKER_TAG }}
47+ tags : ${{ steps.meta.outputs.tags }}
48+ labels : ${{ steps.meta.outputs.labels }}
49+
50+ - name : Image digest
51+ run : echo ${{ steps.docker_build.outputs.digest }}
0 commit comments