File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Push Docker Image
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7
+ - ' beta*' # Push events to matching beta*, i.e. beta1.0, beta20.15.10
8
+
9
+ env :
10
+ REGISTRY : ghcr.io
11
+ IMAGE_NAME : ${{ github.repository }}
12
+
13
+ jobs :
14
+ build :
15
+ runs-on : ubuntu-latest
16
+
17
+ permissions :
18
+ contents : read
19
+ packages : write
20
+
21
+ steps :
22
+ - name : Read Tag
23
+ id : read_tag
24
+ run : echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
25
+
26
+ - name : Checkout repository
27
+ uses : actions/checkout@v4
28
+
29
+ - name : Log in to the Container registry
30
+ uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
31
+ with :
32
+ registry : ${{ env.REGISTRY }}
33
+ username : ${{ github.actor }}
34
+ password : ${{ secrets.GITHUB_TOKEN }}
35
+
36
+ - name : Extract metadata (tags, labels) for Docker
37
+ id : meta
38
+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
39
+ with :
40
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41
+
42
+ - name : Build and push Docker image
43
+ uses : docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
44
+ with :
45
+ context : .
46
+ push : true
47
+ tags : ${{ steps.meta.outputs.tags }}
48
+ labels : ${{ steps.meta.outputs.labels }}
49
+
50
+ - name : Logout from DockerHub
51
+ run : docker logout
You can’t perform that action at this time.
0 commit comments