File tree Expand file tree Collapse file tree 4 files changed +28
-24
lines changed
Expand file tree Collapse file tree 4 files changed +28
-24
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ name: Build and Push Docker Image
22
33on :
44 workflow_call :
5+ inputs :
6+ push_image :
7+ description : ' Whether to push the Docker image'
8+ type : boolean
9+ required : false
10+ default : false
511
612jobs :
713 build :
2632 run : npm test
2733
2834 - name : Log in to GitHub Container Registry
35+ if : inputs.push_image
2936 uses : docker/login-action@v3
3037 with :
3138 registry : ghcr.io
3946 run : npm run build:dockerImage
4047
4148 - name : Push Docker image
49+ if : inputs.push_image
4250 env :
4351 DOCKER_USERNAME : ${{ github.repository_owner }}
4452 run : |
Original file line number Diff line number Diff line change 66 branches :
77 - ' *'
88 - ' !master'
9- pull_request :
9+
10+ permissions :
11+ contents : read
12+ packages : write
1013
1114jobs :
1215 build :
13- runs-on : ubuntu-latest
14-
15- steps :
16- - uses : actions/checkout@v3
17- - uses : actions/setup-node@v3
18- with :
19- node-version : ' 22'
20-
21- - name : install dependencies
22- run : npm i
23-
24- - name : dependency check
25- run : npm run dependencyCheck
26-
27- - name : run tests
28- run : npm test
29-
30- - name : build app & docker image
31- env :
32- DOCKER_REGISTRY : ghcr.io
33- DOCKER_USERNAME : ${{ github.repository_owner }}
34- run : npm run build:dockerImage
16+ uses : ./.github/workflows/build-and-push.yml
17+ with :
18+ push_image : false
Original file line number Diff line number Diff line change 99 tags :
1010 - ' *'
1111
12+ permissions :
13+ contents : read
14+ packages : write
15+
1216jobs :
1317 build-and-push :
1418 uses : ./.github/workflows/build-and-push.yml
19+ with :
20+ push_image : true
Original file line number Diff line number Diff line change 44 release :
55 types : [created]
66
7+ permissions :
8+ contents : read
9+ packages : write
10+
711jobs :
812 build-and-push :
9- uses : ./.github/workflows/build-and-push.yml
13+ uses : ./.github/workflows/build-and-push.yml
14+ with :
15+ push_image : true
You can’t perform that action at this time.
0 commit comments