File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 39
39
run : |
40
40
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
41
41
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
42
+ echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
42
43
- name : Set up QEMU
43
44
id : docker_qemu
44
45
uses : docker/setup-qemu-action@v2
62
63
- name : Login to DockerHub
63
64
id : docker_login
64
65
uses : docker/login-action@v2
66
+ # Only attempt login and push if we have credentials
67
+ if : env.DOCKER_PUSH == 'true'
65
68
with :
66
69
username : ${{ secrets.DOCKERHUB_USERNAME }}
67
70
password : ${{ secrets.DOCKERHUB_PASSWORD }}
78
81
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
79
82
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
80
83
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
81
- push : true
84
+ push : ${{ env.DOCKER_PUSH }}
Original file line number Diff line number Diff line change 49
49
run : |
50
50
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
51
51
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
52
+ echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
52
53
- name : Set up QEMU
53
54
id : docker_qemu
54
55
uses : docker/setup-qemu-action@v2
73
74
- name : Login to DockerHub
74
75
id : docker_login
75
76
uses : docker/login-action@v2
77
+ # Only attempt login and push if we have credentials
78
+ if : env.DOCKER_PUSH == 'true'
76
79
with :
77
80
username : ${{ secrets.DOCKERHUB_USERNAME }}
78
81
password : ${{ secrets.DOCKERHUB_PASSWORD }}
89
92
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
90
93
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
91
94
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
92
- push : true
95
+ push : ${{ env.DOCKER_PUSH }}
Original file line number Diff line number Diff line change 46
46
run : |
47
47
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
48
48
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
49
+ echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
49
50
- name : Set up QEMU
50
51
id : docker_qemu
51
52
uses : docker/setup-qemu-action@v2
72
73
- name : Login to DockerHub
73
74
id : docker_login
74
75
uses : docker/login-action@v2
76
+ # Only attempt login and push if we have credentials
77
+ if : env.DOCKER_PUSH == 'true'
75
78
with :
76
79
username : ${{ secrets.DOCKERHUB_USERNAME }}
77
80
password : ${{ secrets.DOCKERHUB_PASSWORD }}
87
90
STACKS_NODE_VERSION=${{ env.GITHUB_SHA_SHORT }}
88
91
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
89
92
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
90
- push : true
93
+ push : ${{ env.DOCKER_PUSH }}
You can’t perform that action at this time.
0 commit comments