From 225e0afcf1de58812642a8de21068c97db7f6347 Mon Sep 17 00:00:00 2001 From: Jr Rocha Date: Wed, 18 Sep 2024 20:36:45 -0300 Subject: [PATCH] add prod deploy action --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2f7c8fc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: Deploy Main +on: + push: + branches: [ main ] +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Sync + env: + dest: '${{vars.USER}}@${{vars.HOST}}:${{vars.THEMEPATHPROD}}' + run: | + echo "${{secrets.DEPLOY_KEY}}" > deploy_key + chmod 600 ./deploy_key + rsync -chav --delete \ + -e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \ + --exclude /deploy_key \ + --exclude /.git/ \ + --exclude /.github/ \ + --exclude /node_modules/ \ + ./ ${{env.dest}} + + - name: SSH Remote Commands + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{vars.HOST}} + username: ${{vars.USER}} + key: ${{secrets.DEPLOY_KEY}} + script: | + cd ${{vars.THEMEPATHPROD}} + git checkout main + wp theme activate site-america-aberta --allow-root + wp nginx-helper purge-all --allow-root \ No newline at end of file