Update Caddyfile #2
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: Deploy Ecs | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.ECS_PRIVATE_KEY }} | |
- name: Upload files to ECS | |
run: | | |
HOST=${{ secrets.ECS_HOST }} | |
USER=${{ secrets.ECS_USER }} | |
PORT=22 | |
scp -o StrictHostKeyChecking=no -P $PORT Caddyfile $USER@$HOST:/home/$USER/CaddyProxy/Caddyfile | |
scp -o StrictHostKeyChecking=no -P $PORT docker-compose.yml $USER@$HOST:/home/$USER/CaddyProxy/docker-compose.yml | |
- name: Deploy to ECS | |
run: | | |
HOST=${{ secrets.ECS_HOST }} | |
USER=${{ secrets.ECS_USER }} | |
PORT=22 | |
ssh -o StrictHostKeyChecking=no $USER@$HOST << 'EOF' | |
docker compose -f /home/$USER/CaddyProxy/docker-compose.yml down | |
docker compose -f /home/$USER/CaddyProxy/docker-compose.yml up -d | |
EOF |