Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.

Commit 6fdff67

Browse files
authored
[WEAV-000] 개발서버 CD 자동 트리깅 수정 (#264)
1 parent 1755e7e commit 6fdff67

File tree

1 file changed

+20
-28
lines changed

1 file changed

+20
-28
lines changed

.github/workflows/develop_server_deployer.yaml

+20-28
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,25 @@ on:
1515

1616
jobs:
1717
deploy:
18-
needs: [validate_version, check_ci_success]
1918
runs-on: ubuntu-latest
2019
environment: DEV
2120
steps:
21+
- name: Validate version format
22+
if: github.event_name == 'workflow_dispatch'
23+
run: |
24+
if [[ "${{ github.event.inputs.version }}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
25+
echo "Version format is valid"
26+
else
27+
echo "Invalid version format. Use 'latest' or semver format (e.g., 0.2411.135)"
28+
exit 1
29+
fi
30+
31+
- name: Check CI success
32+
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success'
33+
run: |
34+
echo "CI failed"
35+
exit 1
36+
2237
- name: Checkout repository
2338
uses: actions/checkout@v2
2439

@@ -103,7 +118,7 @@ jobs:
103118
104119
- name: Set deployed image version
105120
id: set_version
106-
run: echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
121+
run: echo "version=${{ steps.triggered_workflow_run.outputs.version || github.event.inputs.version }}" >> $GITHUB_OUTPUT
107122

108123
- name: Run Docker Compose up
109124
id: deploy
@@ -115,7 +130,7 @@ jobs:
115130
script: |
116131
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
117132
sudo docker-compose -f ~/app/bootstrap/http/compose-dev.yaml pull
118-
sudo VERSION=${{ github.event.inputs.version }} docker-compose -f ~/app/bootstrap/http/compose-dev.yaml up -d --force-recreate
133+
sudo VERSION=${{ steps.set_version.outputs.version }} docker-compose -f ~/app/bootstrap/http/compose-dev.yaml up -d --force-recreate
119134
120135
- name: Send discord notification (develop server deploy failed)
121136
if: failure() && steps.deploy.outcome == 'failure'
@@ -128,7 +143,7 @@ jobs:
128143
>
129144
> 🛢️ Repository : ${{ github.repository }}
130145
> 🎋 Branch : ${{ github.ref }}
131-
> 📐 Version : ${{ github.event.inputs.version }}
146+
> 📐 Version : ${{ steps.set_version.outputs.version }}
132147
> 🔁 Run Attempt : ${{ github.run_attempt }}
133148
> 🤗 Actor : ${{ github.triggering_actor }}
134149
@@ -165,29 +180,6 @@ jobs:
165180
>
166181
> 🛢️ Repository : ${{ github.repository }}
167182
> 🎋 Branch : ${{ github.ref }}
168-
> 📐 Version : ${{ github.event.inputs.version }}
183+
> 📐 Version : ${{ steps.set_version.outputs.version }}
169184
> 🔁 Run Attempt : ${{ github.run_attempt }}
170185
> 🤗 Actor : ${{ github.triggering_actor }}
171-
172-
validate_version:
173-
runs-on: ubuntu-latest
174-
if: github.event_name == 'workflow_dispatch'
175-
steps:
176-
- name: Validate version format
177-
run: |
178-
if [[ "${{ github.event.inputs.version }}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
179-
echo "Version format is valid"
180-
else
181-
echo "Invalid version format. Use 'latest' or semver format (e.g., 0.2411.135)"
182-
exit 1
183-
fi
184-
185-
check_ci_success:
186-
needs: validate_version
187-
runs-on: ubuntu-latest
188-
steps:
189-
- name: Check CI
190-
if: ${{ github.event.workflow_run != null && github.event.workflow_run.conclusion != 'success' }}
191-
run: |
192-
echo "CI failed"
193-
exit 1

0 commit comments

Comments
 (0)