test: 자동 배포 테스트 #2
Workflow file for this run
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: auto Workflow | ||
on: | ||
push: | ||
branches: | ||
- refactor-be-#33 | ||
workflow_dispatch: | ||
jobs: | ||
image-build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
# root에 .env.local, .env.client, .env.server 복사 | ||
- name: copy .env | ||
run: | | ||
echo "${{ secrets.LOCAL_ENV }}" > .env.local | ||
echo "${{ secrets.CLIENT_ENV }}" > .env.client | ||
echo "${{ secrets.SERVER_ENV }}" > .env.server | ||
# Docker 로그인 | ||
- name: docker hub login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
# octodocs-modules 이미지 빌드 | ||
- name: octodocs-modules image build | ||
run: docker build -f ./services/module/Dockerfile -t summersummerwhy/octodocs-modules . | ||
# octodocs-modules 이미지 푸시 | ||
- name: octodocs-modules image push | ||
run: docker push summersummerwhy/octodocs-modules | ||
# Docker 이미지 빌드 | ||
- name: docker image build | ||
run: | | ||
docker-compose -f compose.prod.yml -f compose.prod.override.yml build | ||
# Docker 이미지 푸시 | ||
- name: docker image push | ||
run: | | ||
docker-compose -f compose.prod.yml -f compose.prod.override.yml push | ||
deploy: | ||
needs: deploy | ||
Check failure on line 49 in .github/workflows/cd-pipeline.yml GitHub Actions / auto WorkflowInvalid workflow file
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: deploy | ||
env: | ||
REMOTE_HOST: ${{ secrets.REMOTE_SERVER_IP }} | ||
REMOTE_USER: ${{ secrets.REMOTE_SERVER_USER }} | ||
SSH_KEY: ${{ secrets.REMOTE_PRIVATE_KEY }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
run: | | ||
mkdir ~/.ssh | ||
echo "$SSH_KEY" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh -o StrictHostKeyChecking=no $REMOTE_USER@$REMOTE_HOST << 'EOF' | ||
cd /root/octodocs | ||
docker-compose -f compose.prod.yml down | ||
docker-compose -f compose.prod.yml pull | ||
docker-compose -f compose.prod.yml up |