File tree Expand file tree Collapse file tree 2 files changed +46
-2
lines changed
Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy to Dev VM
2+
3+ on :
4+ push :
5+ branches : ["dev"]
6+ workflow_dispatch : {}
7+
8+ concurrency :
9+ group : deploy-to-vm
10+ cancel-in-progress : true
11+
12+ jobs :
13+ deploy :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout repo (optional)
17+ uses : actions/checkout@v4
18+
19+ # Start Tailscale on the runner using the official GitHub Action.
20+ # The action reads the client id / secret from env here (you said you already put them as secrets).
21+ - name : Start Tailscale
22+ uses : tailscale/github-action@v4
23+ with :
24+ oauth-client-id : ${{ secrets.TS_OAUTH_CLIENT_ID }}
25+ oauth-secret : ${{ secrets.TS_OAUTH_SECRET }}
26+ tags : tag:ci
27+
28+ - name : SSH to VM and deploy
29+ run : |
30+ ssh -o "StrictHostKeyChecking no" ${{ secrets.INSTANCE_USER}}@${{ secrets.DEV_INSTANCE_TS_IP}} "
31+ cd ${{ secrets.PROJECT_PATH }}/frontend
32+ git checkout dev
33+ git fetch origin main
34+ git reset --hard origin/main
35+ docker compose stop frontend
36+ docker compose rm -f frontend
37+ docker compose build frontend
38+ docker compose up -d --no-deps --force-recreate frontend
39+ docker image prune -af
40+ docker container prune -f
41+ docker system prune -f
42+ "
43+
Original file line number Diff line number Diff line change 1- name : Deploy to VM via Tailscale
1+ name : Deploy to Prod VM
22
33on :
44 push :
2727
2828 - name : SSH to VM and deploy
2929 run : |
30- ssh -o "StrictHostKeyChecking no" ${{ secrets.EC2_USER }}@${{ secrets.EC2_IP }} "
30+ ssh -o "StrictHostKeyChecking no" ${{ secrets.INSTANCE_USER }}@${{ secrets.PROD_INSTANCE_TS_IP }} "
3131 cd ${{ secrets.PROJECT_PATH }}/frontend
32+ git checkout main
3233 git fetch origin main
3334 git reset --hard origin/main
3435 docker compose stop frontend
You can’t perform that action at this time.
0 commit comments