Skip to content

bug : ci 수정

bug : ci 수정 #13

Workflow file for this run

name: Django CD # workflow 이름
on: # Event
pull_request:
types:
- closed
branches: [ develop ]
jobs: # Job
cd: # Job 이름
if: github.event.pull_request.merged == true # Job 실행 조건
runs-on: ubuntu-latest # Runner
steps: # Step
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
# 라이브러리 설치
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# 도커 허브 사용을 위해 도커에 로그인
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # 도커 홈페이지에서 발급받은 토큰 사용
# 이미지 빌드를 위해 .env 생성

Check failure on line 36 in .github/workflows/cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/cd.yml

Invalid workflow file

You have an error in your yaml syntax on line 36
- name: Setting .env
run: |
# echo "${{ secrets.ENV }}" >> .env
echo "DATABASE_NAME=${{ secrets.DATABASE_NAME }}" >> .env
echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env
echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env
echo "DATABASE_HOST=${{ secrets.DATABASE_HOST }}" >> .env
echo "DATABASE_PORT=${{ secrets.DATABASE_PORT }}" >> .env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env
# ... add other variables
cat .env
# docker-compose에서 사용하는 이미지들을 build, 공식 이미지들은 x
- name: Build docker images
run: docker-compose -f docker-compose.yml build
# docker images
# docker hub repository에 이미지들을 push
- name: Push docker images
run: docker-compose -f docker-compose.yml push
# ssh를 통해 EC2에 접속, 접속한 후에 실행할 스크립트 작성
- name: Connect to EC2 using SSH
uses: appleboy/ssh-action@master
with:
host: ${{secrets.AWS_HOST}}
username: ${{secrets.AWS_USERNAME}}
password: ${{ secrets.PASSWD }}
key: ${{ secrets.AWS_KEY_PEM }}
envs: GITHUB_SHA
script: |
cd NextPage/
git pull
sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml down
sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml pull
sudo docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d --build