-
Notifications
You must be signed in to change notification settings - Fork 48
69 lines (54 loc) · 1.79 KB
/
demo_site_deploy.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: deploy-demo-site
on:
workflow_dispatch:
push:
branches: [ "main" ]
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Install npm dependencies
run: npm ci
working-directory: web/
- name: Run npm build
run: export NODE_ENV=prod && npm run build:demo
working-directory: web/
- name: Check build static
run: ls dist/ -la
working-directory: web/
- name: Get Release version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Update Local Version File
run: echo ${{ steps.get_version.outputs.VERSION }} > .release_version
- name: Install Go modules
run: go mod tidy
- name: Build Go
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o Message-Nest
- name: Copy files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWD }}
source: "Message-Nest"
target: ${{ secrets.REMOTE_DEMO_TARGET }}
- name: SSH into server and restart service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWD }}
script: |
${{ secrets.REMOTE_DEMO_SCRIPT }}