-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (93 loc) · 2.8 KB
/
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Deploy
on:
pull_request:
branches: [master]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
TAG: master
jobs:
build-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: paritytech/substrate-telemetry
ref: ${{ env.TAG }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
backend -> target
- name: Build backend
run: cd backend && cargo b -r
- name: Prepare artifacts
run: |
mkdir -p artifact
cp -fv backend/target/release/telemetry_core artifact/
cp -fv backend/target/release/telemetry_shard artifact/
cd artifact
strip telemetry_core || true
strip telemetry_shard || true
- name: Upload artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: artifact
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
repository: paritytech/substrate-telemetry
ref: ${{ env.TAG }}
path: substrate-telemetry
- name: Update source files
run: |
cp -rvf frontend/* substrate-telemetry/frontend
find substrate-telemetry/frontend/src -name "*.css" -type f -exec sed -ie 's/#e6007a/#00a87a/g' {} \;
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
cache-dependency-path: 'substrate-telemetry/frontend/package-lock.json'
- name: Build frontend
run: |
cd substrate-telemetry/frontend && yarn && yarn build
mv -vf build html
tar -cvJf frontend-html.tar.xz html
- name: Prepare artifacts
run: |
mkdir -p artifact
cp -fv substrate-telemetry/frontend/frontend-html.tar.xz artifact/
- name: Upload artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: artifact
upload:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
needs: [build-backend, build-frontend]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
- name: List artifacts
run: |
pwd
ls -la artifact
- name: Deploy
uses: dawidd6/action-ansible-playbook@v2
with:
directory: ansible
playbook: install.yml
key: ${{ secrets.SSH_PRIVATE_KEY }}
options: -u ubuntu
inventory: telemetry.rs