Skip to content

Merge branch 'main' of https://github.com/HyejiYu/PatTurning #30

Merge branch 'main' of https://github.com/HyejiYu/PatTurning

Merge branch 'main' of https://github.com/HyejiYu/PatTurning #30

name: CI/CD for MQ consumers
on:
push:
paths:
- "messagequeue/consumer/HomePlus_consumer.py"
- "messagequeue/consumer/Oasis_consumer.py"
branches:
- main # 원하는 브랜치로 설정 가능
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install rsync # rsync 설치 단계 추가
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Transfer DAG file to GCE
env:
GCE_IP: ${{ secrets.GCE_IP }}
GCE_USER: ${{ secrets.GCE_USER }}
GCE_SSH_PRIVATE_KEY: ${{ secrets.GCE_SSH_PRIVATE_KEY }}
GCE_USER_HOME: ${{ secrets.GCE_USER_HOME }}
run: |
mkdir -p ~/.ssh
echo "${GCE_SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
rsync -avz -e "ssh -o StrictHostKeyChecking=no" "$GITHUB_WORKSPACE/messagequeue/consumer/HomePlus_consumer.py" ${GCE_USER}@${GCE_IP}:${GCE_USER_HOME}/HomePlus_consumer.py
rsync -avz -e "ssh -o StrictHostKeyChecking=no" "$GITHUB_WORKSPACE/messagequeue/consumer/Oasis_consumer.py" ${GCE_USER}@${GCE_IP}:${GCE_USER_HOME}/Oasis_consumer.py