[chore/#368] 버전 추가 수정 #92
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: deploy-dev | |
| on: | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build -x test | |
| - name: Get GitHub Actions IP | |
| id: ip | |
| uses: haythem/public-ip@v1.3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_USER_ACCESS_KEY }} | |
| aws-secret-access-key: ${{ secrets.AWS_USER_SECRET_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Add GitHub IP to Security Group | |
| run: | | |
| aws ec2 authorize-security-group-ingress \ | |
| --group-id ${{ secrets.AWS_SECURITY_GROUP_ID }} \ | |
| --protocol tcp \ | |
| --port 22 \ | |
| --cidr ${{ steps.ip.outputs.ipv4 }}/32 | |
| - name: copy file via ssh | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.IBAS_DEV_HOST }} | |
| username: ${{ secrets.IBAS_DEV_USERNAME }} | |
| key: ${{ secrets.IBAS_DEV_SSH_KEY }} | |
| passphrase: ${{ secrets.IBAS_DEV_PASSWORD }} | |
| source: "docker-compose.yml" | |
| target: ${{ secrets.IBAS_DEV_DEPLOY_PATH }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_STORAGE }}:dev | |
| platforms: linux/arm64 | |
| - name: execute deploy shell script via ssh | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.IBAS_DEV_HOST }} | |
| username: ${{ secrets.IBAS_DEV_USERNAME }} | |
| key: ${{ secrets.IBAS_DEV_SSH_KEY }} | |
| passphrase: ${{ secrets.IBAS_DEV_PASSWORD }} | |
| script: | | |
| bash ${{ secrets.IBAS_DEV_DEPLOY_PATH }}/deploy.sh | |
| - name: Remove GitHub IP from Security Group | |
| if: always() | |
| run: | | |
| aws ec2 revoke-security-group-ingress \ | |
| --group-id ${{ secrets.AWS_SECURITY_GROUP_ID }} \ | |
| --protocol tcp \ | |
| --port 22 \ | |
| --cidr ${{ steps.ip.outputs.ipv4 }}/32 |