-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (119 loc) · 4.39 KB
/
ci.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build
env:
NODE_OPTIONS: --openssl-legacy-provider
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
notify_init:
runs-on: ubuntu-latest
steps:
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Discord notification PR
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: >
<:kolibri:790471932025372693> [[{{ SHORT_SHA }}](https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ SHORT_SHA }})] [Starting Kolibri Frontend build...](https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}?check_suite_focus=true)
```${{ github.event.head_commit.message }}```
build_and_deploy_frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-node@v4
# with:
# node-version: '16.13.0'
- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v2
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm i --legacy-peer-deps
- name: "Build & Deploy Frontend"
run: npm run build
- uses: cloudflare/wrangler-action@v3
name: "Deploy testnet.kolibri.finance"
if: github.ref == 'refs/heads/master' # Only deploy on merge to master
env:
USER: root
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: 'testnet'
- uses: cloudflare/[email protected]
name: "Deploy sandbox.kolibri.finance"
if: github.ref == 'refs/heads/master' # Only deploy on merge to master
env:
USER: root
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: 'sandbox'
- uses: cloudflare/[email protected]
name: "Deploy zeronet.kolibri.finance"
if: github.ref == 'refs/heads/master' # Only deploy on merge to master
env:
USER: root
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: 'zeronet'
- uses: cloudflare/[email protected]
name: "Deploy kolibri.finance"
if: github.ref == 'refs/heads/master' # Only deploy on merge to master
env:
USER: root
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: 'production'
build_and_deploy_ipfs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-node@v2
with:
node-version: '14.17.6'
- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v2
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm install
- name: "Build & Deploy Frontend"
if: github.ref == 'refs/heads/master' # Only deploy on merge to master
env:
IPFS_URL: ${{ secrets.IPFS_URL }}
IPFS_AUTH: ${{ secrets.IPFS_AUTH }}
IPFS_BUILD: 1
run: |
npm run build
npm install [email protected] # Keep this out of direct deps
node scripts/ipfs-upload.js
notify_complete:
runs-on: ubuntu-latest
needs:
- notify_init
- build_and_deploy_frontend
- build_and_deploy_ipfs
steps:
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Discord notification PR
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: >
<:kolibri:790471932025372693> [[{{ SHORT_SHA }}](https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ SHORT_SHA }})] [Kolibri Frontend built successfully!](https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}?check_suite_focus=true)
```${{ github.event.head_commit.message }}```