18-19 update actions/checkout to @v4 and .htaccess deployment #8
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
# See https://stackoverflow.com/questions/60710209/trigger-github-actions-only-when-pr-is-merged | |
name: Deploy | |
concurrency: production | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: | |
env: | |
SSH_USER: planttracer | |
APP_HOST: planttracer.com | |
DEPLOY_DIR: planttracer.com/web-static | |
jobs: | |
if-merged: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Deploy to $APP_HOST $DEPLOY_DIR" | |
run: | | |
echo APP_HOST: $APP_HOST DEPLOY_DIR: $DEPLOY_DIR | |
eval $(ssh-agent) | |
base64 -d <<< "${{ secrets.PT_SSH_BASE64 }}" | ssh-add - | |
ssh-add -l | |
ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=etc/known_hosts $SSH_USER@$APP_HOST "python3 --version; hostname; pwd; cd $DEPLOY_DIR; ls -l" | |
ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=etc/known_hosts $SSH_USER@$APP_HOST "cd $DEPLOY_DIR; git checkout main && git pull --recurse-submodules" |