This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
136 lines (119 loc) · 4.34 KB
/
dapp.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
136
name: Dapp
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "infrastructure/**"
pull_request:
workflow_dispatch:
inputs:
environment:
description: 'Environment for workflow execution'
required: false
default: 'dev'
upstream_builds:
description: 'Upstream builds'
required: false
upstream_ref:
description: 'Git reference to checkout (e.g. branch name)'
required: false
default: 'main'
jobs:
dapp-detect-changes:
runs-on: ubuntu-latest
outputs:
path-filter: ${{ steps.filter.outputs.path-filter }}
steps:
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
- uses: dorny/paths-filter@v2
if: github.event_name == 'pull_request'
id: filter
with:
filters: |
path-filter:
- './!((docs|infrastructure)/**)'
dapp-build-and-publish:
needs: dapp-detect-changes
if: |
github.event_name != 'pull_request'
|| needs.dapp-detect-changes.outputs.path-filter == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Load environment variables
uses: keep-network/ci/actions/load-env-variables@v1
with:
# TODO: Consider passing of `environment` input instead of using
# hardcoded value. Would require some rework in action's code or
# in config files.
environment: 'ropsten'
- uses: actions/setup-node@v2
with:
node-version: "14.x"
# We need this step because the `@keep-network/tbtc.js` which we update in
# next steps has an indirect dependency to `@summa-tx/[email protected]`
# package, which downloads one of its sub-dependencies via unathenticated
# `git://` protocol. That protocol is no longer supported. Thanks to this
# step `https://` is used instead of `git://`.
- name: Configure git to don't use unauthenticated protocol
run: git config --global url."https://".insteadOf git://
- name: Resolve latest tbtc.js
if: github.event_name != 'workflow_dispatch'
run: npm update @keep-network/tbtc.js
- name: Get upstream packages' versions
if: github.event_name == 'workflow_dispatch'
uses: keep-network/ci/actions/upstream-builds-query@v1
id: upstream-builds-query
with:
upstream-builds: ${{ github.event.inputs.upstream_builds }}
query: |
tbtcjs-version = github.com/keep-network/tbtc.js#version
- name: Resolve latest tbtc.js
if: github.event_name == 'workflow_dispatch'
run: |
npm install --save-exact \
@keep-network/tbtc.js@${{ steps.upstream-builds-query.outputs.tbtcjs-version }}
- name: NPM build
run: npm run build
- name: Deploy to GCP bucket
if: github.event_name == 'workflow_dispatch'
uses: thesis/[email protected]
with:
service-key: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
project: ${{ env.GOOGLE_PROJECT_ID }}
bucket-name: dapp.test.tbtc.network
set-website: true
home-page-path: index.html
error-page-path: index.html
build-folder: build
- name: Notify CI about completion of the workflow
if: github.event_name == 'workflow_dispatch'
uses: keep-network/ci/actions/notify-workflow-completed@v1
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
with:
module: "github.com/keep-network/tbtc-dapp"
url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
environment: ${{ github.event.inputs.environment }}
upstream_builds: ${{ github.event.inputs.upstream_builds }}
upstream_ref: ${{ github.event.inputs.upstream_ref }}
version: ${{ github.sha }}
dapp-lint:
needs: dapp-detect-changes
if: |
github.event_name == 'push'
|| needs.dapp-detect-changes.outputs.path-filter == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint