-
Notifications
You must be signed in to change notification settings - Fork 24
172 lines (163 loc) · 6.01 KB
/
pr.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build pull request
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
BACKEND_ENV:
default: ''
description: 'Backend env for special features'
required: false
FEATURE_PAYMASTER:
default: 'off'
description: 'Feature flag for paymaster transactions ("on" | "off")'
required: false
DEFI_SDK_API_URL:
default: wss://api-v4.zerion.io/
description: 'Zerion API'
required: true
DEFI_SDK_TESTNET_API_URL:
default: wss://api-testnet.zerion.io/
description: 'Zerion API Testnet'
required: true
ZERION_API_URL:
default: https://zpi.zerion.io/
description: 'Zerion REST API'
required: true
ZERION_TESTNET_API_URL:
default: https://zpi-testnet.zerion.io/
description: 'Zerion REST API'
required: true
PROXY_URL:
default: https://proxy.zerion.io/
description: 'Proxy API'
required: true
DEFI_SDK_TRANSACTIONS_API_URL:
default: https://transactions.zerion.io
description: 'Transaction Builder API'
required: true
SOCIAL_API_URL:
default: https://social.zerion.io/
description: 'Zerion Social API'
required: true
PR_NUMBER:
default: ''
description: 'Pull request to attach the build to, e.g. 468'
required: false
jobs:
build_pull_request:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies and build
env:
DEFI_SDK_API_URL: ${{ github.event.inputs.DEFI_SDK_API_URL || 'wss://api-v4.zerion.io/' }}
DEFI_SDK_TESTNET_API_URL: ${{ github.event.inputs.DEFI_SDK_TESTNET_API_URL || 'wss://api-testnet.zerion.io/' }}
ZERION_API_URL: ${{ github.event.inputs.ZERION_API_URL || 'https://zpi.zerion.io/' }}
ZERION_TESTNET_API_URL: ${{ github.event.inputs.ZERION_TESTNET_API_URL || 'https://zpi-testnet.zerion.io/' }}
BACKEND_ENV: ${{ github.event.inputs.BACKEND_ENV || '' }}
FEATURE_PAYMASTER: ${{ github.event.inputs.FEATURE_PAYMASTER || 'on' }}
PROXY_URL: ${{ github.event.inputs.PROXY_URL || 'https://proxy.zerion.io/' }}
DEFI_SDK_TRANSACTIONS_API_URL: ${{ github.event.inputs.DEFI_SDK_TRANSACTIONS_API_URL || 'https://transactions.zerion.io' }}
DEFI_SDK_API_TOKEN: Zerion.0JOY6zZTTw6yl5Cvz9sdmXc7d5AhzVMG
SOCIAL_API_URL: ${{ github.event.inputs.SOCIAL_API_URL || 'https://social.zerion.io/' }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}
FEATURE_SEND_FORM: on
FEATURE_FOOTER_BUG_BUTTON: off
MIXPANEL_TOKEN_PUBLIC: ${{ secrets.MIXPANEL_TOKEN_PUBLIC_DEV }}
FEATURE_LOYALTY_FLOW: on
run: |
npm install
npm run build:production
- name: Save PR number
if: ${{ success() }}
env:
PR_NUMBER: ${{ github.event.inputs.PR_NUMBER || github.event.number }}
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr/
- name: Compress build artifacts
if: ${{ success() }}
shell: bash
run: |
mv dist zerion-wallet-extension-${{github.sha}}
zip -r zerion-wallet-extension-${{github.sha}}.zip zerion-wallet-extension-${{github.sha}}
- name: Upload build
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: zerion-wallet-extension
path: zerion-wallet-extension-${{github.sha}}.zip
- name: Notify build succeeded
id: notify-build-succeeded
if: ${{ success() }}
uses: slackapi/[email protected]
with:
channel-id: 'C04JLLQRB43'
payload: |
{
"text": ${{ toJSON(format('Build: {0}', github.event.pull_request.title)) }},
"icon_emoji": ":nyancat:",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('<{0}|{1}> {2}', github.event.pull_request.html_url, github.event.pull_request.title, github.pull_request.draft && ':construction:' || '')) }}
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "*Initiated by:* ${{ github.triggering_actor }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_AUTH_TOKEN }}
- name: Notify build failed
id: notify-build-failed
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
channel-id: 'C04JLLQRB43'
payload: |
{
"text": ${{ toJSON(format('Build: {0}', github.event.pull_request.title)) }},
"icon_emoji": ":cry-cat:",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('<{0}|{1}> {2}', github.event.pull_request.html_url, github.event.pull_request.title, github.pull_request.draft && ':construction:' || '')) }}
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "*Initiated by*: ${{ github.triggering_actor }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_AUTH_TOKEN }}