fix: success list map #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GOGO Betting stage CD Workflow | |
| #on: | |
| # push: | |
| # branches: | |
| # - 'develop' | |
| # workflow_dispatch: | |
| jobs: | |
| CI: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Setup Gradle's permission | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew clean build | |
| deploy: | |
| needs: CI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install sshpass and OpenSSH | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y sshpass openssh-client | |
| - name: Create SSH key for Bastion and Target | |
| run: | | |
| echo "${{ secrets.STAGE_BASTION_SSH_KEY }}" > $HOME/bastion_key.pem | |
| chmod 600 $HOME/bastion_key.pem | |
| - name: SSH Command to Deploy using Bastion and Target Instance | |
| run: | | |
| ssh -i "$HOME/bastion_key.pem" -o StrictHostKeyChecking=no ubuntu@${{ secrets.STAGE_BASTION_HOST }} << 'EOF' | |
| ssh -i gogo-stage.pem -o StrictHostKeyChecking=no ubuntu@${{ secrets.STAGE_TARGET_HOST }} << 'EOF2' | |
| mkdir -p /home/ubuntu/gogo-betting | |
| cd /home/ubuntu/gogo-betting | |
| if [ ! -d ".git" ]; then | |
| git clone -b develop https://github.com/team-gogo/gogo-betting.git . | |
| else | |
| git pull origin develop | |
| fi | |
| ./gradlew clean build | |
| docker build -f DockerFileStage -t gogo-betting-stage . | |
| docker stop gogo-betting-stage || true | |
| docker rm gogo-betting-stage || true | |
| docker run -d -p 8083:8083 --add-host host.docker.internal:host-gateway --name gogo-betting-stage gogo-betting-stage | |
| - name: SSH Success Notification | |
| if: success() | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| color: 0x4CAF50 | |
| title: "배포 성공" | |
| message: "GOGO User stage deployment completed successfully." | |
| - name: SSH Failure Notification | |
| if: failure() | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| color: 0xFF4C4C | |
| title: "배포 실패" | |
| message: "GOGO User stage deployment failed. Check the logs for details." |