Skip to content

Commit

Permalink
[Issue] cicd.yml 파일 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
82everywin committed Oct 29, 2024
1 parent 5f4466c commit a8442e7
Showing 1 changed file with 3 additions and 60 deletions.
63 changes: 3 additions & 60 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@ jobs:
touch ./src/main/resources/application.properties
echo "${{ secrets.PROPERTIES }}" > ./src/main/resources/application.properties
# .gitingnore에 있는 .env파일 docker compose 실행을 위해 추가
- name: Add .env
run: |
touch .env
echo "${{ secrets.ENV }}" > .env
- name: Verify .env file
run: |
ls -l .env
cat .env
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -67,52 +54,8 @@ jobs:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}

CD:
needs: [ CI ]

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# .gitignore에 있는 properties파일 추가
- name: Add prod_properties
run: |
mkdir ./src/main/resources
touch ./src/main/resources/application.properties
echo "${{ secrets.PROPERTIES }}" > ./src/main/resources/application.properties
# .gitingnore에 있는 .env파일 docker compose 실행을 위해 추가
- name: Add .env
run: |
touch .env
echo "${{ secrets.ENV }}" > .env
- name: Verify .env file
run: |
ls -l .env
cat .env

- name: Deploy .env to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DEPLOYMENT_HOST }}
username: ${{ secrets.DEPLOYMENT_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ./.env
target: /home/serverking/marketplace

- name: Deploy docker compose file
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DEPLOYMENT_HOST }}
username: ${{ secrets.DEPLOYMENT_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ./docker-compose.yml
target: /home/serverking/marketplace

# CD 배포
- name: Deploy remote ssh commands using password
uses: appleboy/ssh-action@master
with:
Expand All @@ -122,5 +65,5 @@ jobs:
script_stop: true
script: |
cd marketplace
docker-compose pull
docker-compose up -d
chmod +x ./deploy.sh
./deploy.sh

0 comments on commit a8442e7

Please sign in to comment.