Merge pull request #158 from team-gogo/revert-157-update/match-search… #13
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 Stage On-premise 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: SSH Command to Deploy using Bastion and Target Instance | |
| run: | | |
| sshpass -p "${{ secrets.STAGE_ON_PREMISE_PASSWORD }}" ssh -o StrictHostKeyChecking=no ubuntu@${{ secrets.STAGE_ON_PREMISE_HOST }} << 'EOF' | |
| mkdir -p /home/ubuntu/gogo-stage | |
| cd /home/ubuntu/gogo-stage | |
| if [ ! -d ".git" ]; then | |
| git clone -b develop https://github.com/team-gogo/gogo-stage.git . | |
| else | |
| git pull origin develop | |
| fi | |
| ./gradlew clean build | |
| docker build -f DockerFileStage -t gogo-stage-stage . | |
| docker stop gogo-stage-stage || true | |
| docker rm gogo-stage-stage || true | |
| docker run -d -p 8082:8082 --add-host host.docker.internal:host-gateway --name gogo-stage-stage gogo-stage-stage | |
| - name: SSH Success Notification | |
| if: success() | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| color: 0x4CAF50 | |
| title: "배포 성공" | |
| message: "GOGO Stage On-premise 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 Stage On-premise stage deployment failed. Check the logs for details." |