Skip to content

Commit 8aa2e96

Browse files
committed
Chore: ci-cd.yml 수정 (dev 머지 준비)
1 parent d24b99a commit 8aa2e96

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/ci-cd.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: CI/CD — Backend (Build → Push → Deploy)
22

33
on:
4+
# dev에 머지 전 ci push 대상 브랜치 중첩 적용 (release, dev)
45
push:
5-
branches: [ release ]
6+
branches: [ release, dev ]
7+
pull_request:
8+
branches: [ dev ]
69
workflow_dispatch: {}
710

811
jobs:
@@ -57,14 +60,21 @@ jobs:
5760
echo "No Dockerfile found"; exit 1
5861
fi
5962
63+
- name: Build image (PR only)
64+
if: github.event_name == 'pull_request'
65+
run: |
66+
docker build -f "${{ steps.df.outputs.path }}" -t sanity-check:pr "${{ steps.df.outputs.ctx }}"
67+
6068
- name: Log in to GHCR
69+
if: github.event_name == 'push'
6170
uses: docker/login-action@v3
6271
with:
6372
registry: ghcr.io
6473
username: ${{ github.actor }}
6574
password: ${{ secrets.GITHUB_TOKEN }}
6675

6776
- name: Build & Push image
77+
if: github.event_name == 'push'
6878
run: |
6979
GIT_SHA=${{ github.sha }}
7080
docker build -f "${{ steps.df.outputs.path }}" -t $IMAGE:release -t $IMAGE:$GIT_SHA "${{ steps.df.outputs.ctx }}"
@@ -73,7 +83,8 @@ jobs:
7383
7484
deploy:
7585
needs: build-and-push
76-
if: github.ref == 'refs/heads/release' && needs.build-and-push.result == 'success'
86+
# dev에 머지 전 cd 대상 브랜치 중첩 적용 (release, dev)
87+
if: github.event_name == 'push' && (github.ref == 'refs/heads/release' || github.ref == 'refs/heads/dev') && needs.build-and-push.result == 'success'
7788
runs-on: ubuntu-latest
7889
steps:
7990
- name: Deploy

0 commit comments

Comments
 (0)