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

Commit

Permalink
[WEAV-000] 개발서버 CD 자동 트리깅 수정 (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW authored May 1, 2024
1 parent 1755e7e commit 6fdff67
Showing 1 changed file with 20 additions and 28 deletions.
48 changes: 20 additions & 28 deletions .github/workflows/develop_server_deployer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@ on:

jobs:
deploy:
needs: [validate_version, check_ci_success]
runs-on: ubuntu-latest
environment: DEV
steps:
- name: Validate version format
if: github.event_name == 'workflow_dispatch'
run: |
if [[ "${{ github.event.inputs.version }}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Version format is valid"
else
echo "Invalid version format. Use 'latest' or semver format (e.g., 0.2411.135)"
exit 1
fi
- name: Check CI success
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success'
run: |
echo "CI failed"
exit 1
- name: Checkout repository
uses: actions/checkout@v2

Expand Down Expand Up @@ -103,7 +118,7 @@ jobs:
- name: Set deployed image version
id: set_version
run: echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
run: echo "version=${{ steps.triggered_workflow_run.outputs.version || github.event.inputs.version }}" >> $GITHUB_OUTPUT

- name: Run Docker Compose up
id: deploy
Expand All @@ -115,7 +130,7 @@ jobs:
script: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker-compose -f ~/app/bootstrap/http/compose-dev.yaml pull
sudo VERSION=${{ github.event.inputs.version }} docker-compose -f ~/app/bootstrap/http/compose-dev.yaml up -d --force-recreate
sudo VERSION=${{ steps.set_version.outputs.version }} docker-compose -f ~/app/bootstrap/http/compose-dev.yaml up -d --force-recreate
- name: Send discord notification (develop server deploy failed)
if: failure() && steps.deploy.outcome == 'failure'
Expand All @@ -128,7 +143,7 @@ jobs:
>
> 🛢️ Repository : ${{ github.repository }}
> 🎋 Branch : ${{ github.ref }}
> 📐 Version : ${{ github.event.inputs.version }}
> 📐 Version : ${{ steps.set_version.outputs.version }}
> 🔁 Run Attempt : ${{ github.run_attempt }}
> 🤗 Actor : ${{ github.triggering_actor }}
Expand Down Expand Up @@ -165,29 +180,6 @@ jobs:
>
> 🛢️ Repository : ${{ github.repository }}
> 🎋 Branch : ${{ github.ref }}
> 📐 Version : ${{ github.event.inputs.version }}
> 📐 Version : ${{ steps.set_version.outputs.version }}
> 🔁 Run Attempt : ${{ github.run_attempt }}
> 🤗 Actor : ${{ github.triggering_actor }}
validate_version:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Validate version format
run: |
if [[ "${{ github.event.inputs.version }}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Version format is valid"
else
echo "Invalid version format. Use 'latest' or semver format (e.g., 0.2411.135)"
exit 1
fi
check_ci_success:
needs: validate_version
runs-on: ubuntu-latest
steps:
- name: Check CI
if: ${{ github.event.workflow_run != null && github.event.workflow_run.conclusion != 'success' }}
run: |
echo "CI failed"
exit 1

0 comments on commit 6fdff67

Please sign in to comment.