-
-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (82 loc) · 2.5 KB
/
node.js.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Node.js CI
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
concurrency:
group: "${{ github.workflow }}-${{ github.ref_name }}-${{ github.event_name }}"
cancel-in-progress: true
jobs:
build:
name: build application
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
env:
REACT_APP_DONATION_ADDRESS: ${{ secrets.DONATION_ADDRESS }}
REACT_APP_VERSION: ${GITHUB_SHA}
REACT_APP_HORIZON_URL: ${{ secrets.HORIZON_URL }}
- name: store build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: build
retention-days: 1
- name: store server
uses: actions/upload-artifact@v4
with:
name: server
path: index.js
retention-days: 1
deploy:
if: ${{ github.event_name == 'push' }}
name: Deploy via rsync
environment:
name: asteroids
url: https://balances.lumens.space
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: retrieve build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifact
path: build
- name: retrieve compiled server
uses: actions/download-artifact@v4
with:
name: server
path: .
- name: deploy using rsync
uses: burnett01/rsync-deployments@5.2
with:
switches: -avzr --delete --include="build/" --include="build/**" --include="index.js" --exclude="*"
path: /
remote_path: ${{ secrets.PATH }}/
remote_host: ${{ secrets.HOST }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.KEY }}
- uses: fifsky/ssh-action@master
name: restart remote service
with:
user: ${{ secrets.USERNAME }}
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
command: |
cd ${{ secrets.PATH }}; git pull --rebase -f