Skip to content

Commit 208e418

Browse files
authored
feat: fix CI: restrict release-and-push job to master branch only (#102)
1 parent ccad01d commit 208e418

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
release-and-push:
6161
name: Release And Push
6262
runs-on: ubuntu-latest
63-
if: github.repository == 'casbin/caswaf' && github.event_name == 'push'
63+
if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master'
6464
needs: [ frontend, backend]
6565
steps:
6666
- name: Checkout
@@ -104,14 +104,14 @@ jobs:
104104

105105
- name: Log in to Docker Hub
106106
uses: docker/login-action@v1
107-
if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
107+
if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.should_push.outputs.push=='true'
108108
with:
109109
username: ${{ secrets.DOCKERHUB_USERNAME }}
110110
password: ${{ secrets.DOCKERHUB_PASSWORD }}
111111

112112
- name: Push to Docker Hub
113113
uses: docker/build-push-action@v3
114-
if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
114+
if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.should_push.outputs.push=='true'
115115
with:
116116
context: .
117117
target: STANDARD

0 commit comments

Comments
 (0)