-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (134 loc) · 4.73 KB
/
nodejs.yml
File metadata and controls
142 lines (134 loc) · 4.73 KB
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
137
138
139
140
141
142
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [master]
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: 0 days
skip-tags: true
skip-recent: 2
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: yarn install
- name: Linting JS
run: yarn lint
- name: Build
run: yarn generate
env:
INFURA_KEY: ${{ secrets.INFURA_KEY }}
ALCHEMY_MAINNET_KEY: ${{ secrets.ALCHEMY_MAINNET_KEY }}
ALCHEMY_POLYGON_KEY: ${{ secrets.ALCHEMY_POLYGON_KEY }}
ALCHEMY_OPTIMISM_KEY: ${{ secrets.ALCHEMY_OPTIMISM_KEY }}
ALCHEMY_ARBITRUM_KEY: ${{ secrets.ALCHEMY_ARBITRUM_KEY }}
ALCHEMY_GOERLI_KEY: ${{ secrets.ALCHEMY_GOERLI_KEY }}
WC_BRIDGE: ${{ secrets.WC_BRIDGE }}
OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }}
STORE_NAME: ${{ secrets.STORE_NAME }}
APP_ENS_NAME: ${{ secrets.APP_ENS_NAME }}
- name: Upload artefact
uses: actions/upload-artifact@v1.0.0
with:
name: dist
path: dist
deploy-minified:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact `dist`
uses: actions/download-artifact@v1
with:
name: dist
- name: Add SSH key
uses: webfactory/ssh-agent@v0.2.0
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add git remote
run: |
git init
git config --local user.email "actions@github.com"
git config --local user.name "GitHub"
echo dist > .gitignore && git add .gitignore && git commit -m push-dir
git remote add ui git@github.com:tornadocash/ui-minified.git
- name: Deploying...
run: npx push-dir --dir=dist --branch=master --cleanup --remote=ui
deploy-docker:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download artifact `dist`
uses: actions/download-artifact@v1
with:
name: dist
- name: Build and push Docker image
uses: docker/build-push-action@v1.1.0
with:
path: dist
dockerfile: Dockerfile
repository: tornadocash/ui
tags: latest
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
deploy-ipfs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: yarn install
- name: Download artifact `dist`
uses: actions/download-artifact@v1
with:
name: dist
- name: Upload to IPFS
id: upload
run: yarn ipfsUpload dist
env:
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}
notify:
runs-on: ubuntu-latest
if: always()
needs:
- deploy-minified
- deploy-docker
- deploy-ipfs
steps:
# ${{ env.WORKFLOW_CONCLUSION }} # neutral, success, cancelled, timed_out, failure
- uses: technote-space/workflow-conclusion-action@v2
- name: Set short SHA
id: vars
run: echo "::set-output name=sha_short::$(echo ${GITHUB_SHA:0:7})"
- name: Telegram Message Notify
uses: appleboy/telegram-action@v0.1.1
if: ${{ env.WORKFLOW_CONCLUSION == 'success' }}
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN}}
message: 🚀 Deployed commit [${{ steps.vars.outputs.sha_short }}](https://github.com/tornadocash/tornado-cash-ui/commit/${{ github.sha }}) of tornado.cash UI
format: markdown
- name: Telegram Failure Notification
uses: appleboy/telegram-action@v0.1.1
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' || env.WORKFLOW_CONCLUSION == 'timed_out' || env.WORKFLOW_CONCLUSION == 'neutral' }}
with:
message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
format: markdown
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}