File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ # See https://stackoverflow.com/questions/60710209/trigger-github-actions-only-when-pr-is-merged
2
+ name : Deploy
3
+ concurrency : production
4
+
5
+ on :
6
+ pull_request :
7
+ types : [closed]
8
+ workflow_dispatch :
9
+
10
+ env :
11
+ SSH_USER : planttracer
12
+ APP_HOST : planttracer.com
13
+ DEPLOY_DIR : planttracer.com/web-static
14
+
15
+ jobs :
16
+ if-merged :
17
+ if : github.event.pull_request.merged == true
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - name : Checkout
21
+ uses : actions/checkout@v3
22
+
23
+ - name : " Deploy to $APP_HOST $DEPLOY_DIR"
24
+ run : |
25
+ echo APP_HOST: $APP_HOST DEPLOY_DIR: $DEPLOY_DIR
26
+ eval $(ssh-agent)
27
+ base64 -d <<< "${{ secrets.PT_SSH_BASE64 }}" | ssh-add -
28
+ ssh-add -l
29
+ ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=etc/known_hosts $SSH_USER@$APP_HOST "python3 --version; hostname; pwd; cd $DEPLOY_DIR; ls -l"
30
+ ssh -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=etc/known_hosts $SSH_USER@$APP_HOST "cd $DEPLOY_DIR; git checkout main && git pull --recurse-submodules"
You can’t perform that action at this time.
0 commit comments