diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..19ba0f2 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,30 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up SSH Key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + - name: Configure SSH known_hosts + run: | + ssh-keyscan -H ${{ secrets.REMOTE_IP }} >> ~/.ssh/known_hosts + + - name: Deploy using Docker Compose + env: + DOCKER_HOST: ssh://root@${{ secrets.REMOTE_IP }} + run: | + docker compose --file compose.yaml --file cloudflare.yaml --file logging.yaml up --build -d