File tree Expand file tree Collapse file tree 2 files changed +62
-1
lines changed Expand file tree Collapse file tree 2 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 1
1
name : CI/CD
2
2
3
3
on :
4
- - push
4
+ push :
5
+ branches : [ "main" ]
6
+ release :
7
+ types : [ published ]
5
8
6
9
jobs :
7
10
lint :
Original file line number Diff line number Diff line change
1
+ name : Publish Docker image
2
+
3
+ on :
4
+ workflow_run :
5
+ workflows : ["CI/CD"]
6
+ types :
7
+ - completed
8
+ branches :
9
+ - main
10
+
11
+ env :
12
+ REGISTRY : ghcr.io
13
+ IMAGE_NAME : ${{ github.repository }}
14
+
15
+ jobs :
16
+ build-and-push :
17
+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
18
+ runs-on : ubuntu-latest
19
+ permissions :
20
+ contents : read
21
+ packages : write
22
+
23
+ steps :
24
+ - name : Checkout repository
25
+ uses : actions/checkout@v4
26
+
27
+ - name : Set up Docker Buildx
28
+ uses : docker/setup-buildx-action@v3
29
+
30
+ - name : Log in to the Container registry
31
+ uses : docker/login-action@v3
32
+ with :
33
+ registry : ${{ env.REGISTRY }}
34
+ username : ${{ github.actor }}
35
+ password : ${{ secrets.GITHUB_TOKEN }}
36
+
37
+ - name : Extract metadata (tags, labels) for Docker
38
+ id : meta
39
+ uses : docker/metadata-action@v5
40
+ with :
41
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42
+ tags : |
43
+ type=raw,value=latest,enable={{is_default_branch}}
44
+ type=semver,pattern={{version}}
45
+ type=sha,format=long
46
+ type=ref,event=branch
47
+ type=ref,event=tag
48
+
49
+ - name : Build and push Docker image
50
+ uses : docker/build-push-action@v5
51
+ with :
52
+ context : .
53
+ push : true
54
+ platforms : linux/amd64,linux/arm64
55
+ tags : ${{ steps.meta.outputs.tags }}
56
+ labels : ${{ steps.meta.outputs.labels }}
57
+ cache-from : type=gha
58
+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments