-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.35 KB
/
deploy-dev.yml
File metadata and controls
43 lines (37 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Deploy to Dev VM
on:
push:
branches: ["dev"]
workflow_dispatch: {}
concurrency:
group: deploy-to-vm
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo (optional)
uses: actions/checkout@v4
# Start Tailscale on the runner using the official GitHub Action.
# The action reads the client id / secret from env here (you said you already put them as secrets).
- name: Start Tailscale
uses: tailscale/github-action@v4
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: SSH to VM and deploy
run: |
ssh -o "StrictHostKeyChecking no" ${{ secrets.INSTANCE_USER}}@${{ secrets.DEV_INSTANCE_TS_IP}} "
cd ${{ secrets.PROJECT_PATH }}/frontend
git checkout dev
git fetch origin dev
git reset --hard origin/dev
docker compose -f compose.dev.yml stop frontend-dev
docker compose -f compose.dev.yml rm -f frontend-dev
docker compose -f compose.dev.yml build frontend-dev
docker compose -f compose.dev.yml up -d --force-recreate frontend-dev
docker image prune -af
docker container prune -f
docker system prune -f
"