File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish Docker image
2
+
3
+ on :
4
+ push :
5
+ branches : [ "*" ]
6
+ pull_request :
7
+ branches : [ "*" ]
8
+
9
+ env :
10
+ DOCKER_ID : ${{ secrets.DOCKER_ID }}
11
+ IMAGE_NAME : blog-php
12
+ DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
13
+ DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
14
+
15
+ jobs :
16
+ shellcheck :
17
+ name : Shellcheck
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - uses : actions/checkout@v4
21
+ name : Checkout repository
22
+
23
+ - name : Copy .env.example to .env
24
+ run : cp .env.example .env
25
+
26
+ - name : Run ShellCheck
27
+ uses : ludeeus/action-shellcheck@master
28
+ with :
29
+ check_together : ' yes'
30
+ ignore_paths : >-
31
+ sources
32
+
33
+ push_to_registry :
34
+ if : github.event_name != 'pull_request'
35
+ name : Build and push Docker image
36
+ needs : shellcheck
37
+ runs-on : ubuntu-latest
38
+ steps :
39
+ - name : Checkout repository
40
+ uses : actions/checkout@v4
41
+
42
+ - name : Setup Docker Buildx
43
+ uses : docker/setup-buildx-action@v3
44
+
45
+ - name : Log into Docker Hub
46
+ uses : docker/login-action@v3
47
+ with :
48
+ username : ${{ env.DOCKER_USERNAME }}
49
+ password : ${{ env.DOCKER_PASSWORD }}
50
+
51
+ - name : Extract Docker metadata
52
+ id : meta
53
+ uses : docker/metadata-action@v5
54
+ with :
55
+ images : ${{ env.DOCKER_ID }}/${{ env.IMAGE_NAME }}
56
+
57
+ - name : Build and push Docker image
58
+ id : build-and-push
59
+ uses : docker/build-push-action@v6
60
+ with :
61
+ context : .
62
+ file : php/Dockerfile
63
+ push : true
64
+ tags : ${{ steps.meta.outputs.tags }}
65
+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments