refactor: ssh 접속시 key가 아닌 password로 접속하도록 수정 #2
This file contains 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: Gateway-Deploy | |
# | |
#on: | |
# pull_request: | |
# branches: | |
# - deploy | |
# types: | |
# - closed | |
# paths: | |
# - "gateway/**" | |
# | |
## push: | |
## branches: [WB-115-api-server] # master branch에 PR을 보낼 때 실행 | |
# | |
#jobs: | |
# deploy: | |
# runs-on: ubuntu-latest | |
# | |
# # services: | |
# # redis: | |
# # image: redis:6.x | |
# # ports: | |
# # - 6379:6379 | |
# steps: | |
# | |
# - name: Checkout code | |
# uses: actions/checkout@v3 | |
# | |
# - name: Check if the pull request was merged | |
# id: check_pr_merged | |
# run: | | |
# # Check if the PR was merged | |
# if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then | |
# echo "pr_merged=true" >> $GITHUB_ENV | |
# else | |
# echo "pr_merged=false" >> $GITHUB_ENV | |
# fi | |
# | |
# - name: Run some action if the PR was merged | |
# if: env.pr_merged == 'true' | |
# run: | | |
# echo "The pull request was merged. Running additional actions..." | |
# | |
# - uses: actions/checkout@v2 | |
# | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 17 | |
# | |
# - name: 💾 Cache Gradle & Spring | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.gradle/caches | |
# ~/.gradle/wrapper | |
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
# restore-keys: | | |
# ${{ runner.os }}-gradle- | |
# | |
# - name: Set YML | |
# run: | | |
# cd gateway | |
# ls -l | |
# mkdir -p src/main/resources | |
# echo "${{ secrets.SSL_KEYSTORE }}" | base64 --decode > src/main/resources/keystore.p12 | |
# find src | |
# | |
# # Gradle wrapper 파일 실행 권한주기 | |
# - name: Grant execute permission for gradlew | |
# run: chmod +x gradlew | |
# | |
# - name: 🔧 Build Spring server | |
# run: | | |
# chmod +x ./gradlew | |
# ./gradlew clean gateway:build | |
# | |
# - name: Docker build | |
# run: | | |
# cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/gateway | |
# docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} | |
# docker build --no-cache --platform linux/arm64 -t app . | |
# | |
# docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest | |
# docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest | |
# | |
# | |
# - name: deploy in aws | |
# uses: appleboy/ssh-action@master | |
# with: | |
# key: ${{secrets.SSH_KEY}} | |
# host: ${{secrets.GATEWAY_SSH_HOST}} | |
# username: ${{secrets.SSH_USER}} | |
# script: | | |
# docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest | |
# docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest watermelon-api-gateway:latest | |
# docker stop $(docker ps -a -q) | |
# docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-gateway -p 8080:8080 watermelon-api-gateway:latest | |
# docker rm $(docker ps --filter 'status=exited' -a -q) | |
# # 실행 중이지 않으 모든 컨테인 삭제 | |
# docker image prune -a -f | |
# # 사용하지않은 모든 이미지 삭제 | |
# |