File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,11 @@ name: Build and Deploy
22
33on :
44 push :
5- branches : [main]
5+ branches :
6+ - " **"
7+ pull_request :
8+ branches :
9+ - " **"
610
711env :
812 REGISTRY : ghcr.io
4953 deploy :
5054 needs : build
5155 runs-on : ubuntu-latest
56+ if : github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref_name, 'release/'))
5257 strategy :
5358 matrix :
5459 host : [web01.home, web02.home]
7176 git clone https://github.com/${{ github.repository }}.git /home/ec2-user/2026_team10
7277 fi
7378 cd /home/ec2-user/2026_team10
74- git fetch origin main
75- git checkout main
76- git pull --ff-only origin main
79+ git fetch origin ${{ github.ref_name }}
80+ git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }}
81+ git pull --ff-only origin ${{ github.ref_name }}
7782 echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
7883 docker compose -f docker-compose.yaml pull
7984 docker compose -f docker-compose.yaml up -d --remove-orphans
You can’t perform that action at this time.
0 commit comments