-
Notifications
You must be signed in to change notification settings - Fork 46
114 lines (107 loc) · 4.46 KB
/
fleekxyz_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
112
113
114
name: WebApp Deploy fleek.xyz
on:
workflow_dispatch:
push:
branches:
- 'DOPS-634-Fleek-deprecation-migrate-aragon-app'
jobs:
#######################
# setting environment #
#######################
set-environment:
runs-on: ubuntu-latest
outputs:
#environment: ${{ steps.envdev.outputs.environment }}${{ steps.envprod.outputs.environment }}
#workaround to use allways the same environmnet (will be fixed once we merge with default branch)
environment: 'production'
steps:
- name: Set environment to staging
if: endsWith(github.ref, '/develop')
id: envdev
run: echo "environment=staging" >> $GITHUB_OUTPUT
- name: Set environment to prod
if: endsWith(github.ref, '/main')
id: envprod
run: echo "environment=production" >> $GITHUB_OUTPUT
##################
# Build the code #
##################
build-and-deploy:
runs-on: ubuntu-latest
needs: [set-environment]
if: needs.set-environment.outputs.environment != ''
environment: ${{ needs.set-environment.outputs.environment }}
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install depdendencies
run: yarn install --pure-lockfile
- name: Test
run: yarn test
- name: Build
run: yarn build --mode ${{ needs.set-environment.outputs.environment }}
env:
VITE_REACT_APP_DEPLOY_VERSION: ${{ github.sha }}
VITE_REACT_APP_DEPLOY_ENVIRONMENT: ${{ needs.set-environment.outputs.environment }}
VITE_REACT_APP_ANALYTICS_KEY: ${{ secrets.VITE_REACT_APP_ANALYTICS_KEY }}
VITE_GATEWAY_IPFS_API_KEY: ${{secrets.VITE_GATEWAY_IPFS_API_KEY}}
VITE_ETHERSCAN_API_KEY: ${{secrets.VITE_ETHERSCAN_API_KEY}}
VITE_POLYGONSCAN_API_KEY: ${{secrets.VITE_POLYGONSCAN_API_KEY}}
VITE_WALLET_CONNECT_PROJECT_ID: ${{secrets.VITE_WALLET_CONNECT_PROJECT_ID}}
VITE_GATEWAY_RPC_API_KEY: ${{secrets.VITE_GATEWAY_RPC_API_KEY}}
VITE_ALCHEMY_KEY_POLYGON_MUMBAI: ${{secrets.VITE_ALCHEMY_KEY_POLYGON_MUMBAI}}
VITE_ALCHEMY_KEY_POLYGON_MAINNET: ${{secrets.VITE_ALCHEMY_KEY_POLYGON_MUMBAI}}
VITE_ALCHEMY_KEY_MAINNET: ${{secrets.VITE_ALCHEMY_KEY_MAINNET}}
VITE_ALCHEMY_KEY_GOERLI: ${{secrets.VITE_ALCHEMY_KEY_GOERLI}}
VITE_COVALENT_API_KEY: ${{secrets.VITE_COVALENT_API_KEY}}
NODE_OPTIONS: '--max-old-space-size=6656'
######################
# Deploy to fleekxyz #
######################
- name: Take correct fleek config
env:
FLEEK_FILE: ${{ needs.set-environment.outputs.environment }}
run: mv ./.github/fleek/fleekxyz_${FLEEK_FILE}.config.json fleek.config.json
- name: Load credentials from 1Password
id: op-credentials
uses: 1password/load-secrets-action@v1
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{secrets.OP_SERVICE_ACCOUNT_TOKEN_PRODUCTION}}
FLEEK_PROJECT_ID: op://apikeys_production/fleek.xyz_aragon-production/username
FLEEK_TOKEN: op://apikeys_production/fleek.xyz_aragon-production/credential
- name: Install Fleek CLI
run: npm i -g @fleekxyz/cli
- name: Deploy through Fleek
id: deploy
run: ls -la && fleek sites deploy; tree
env:
FLEEK_TOKEN: ${{ steps.op-credentials.outputs.FLEEK_TOKEN}}
FLEEK_PROJECT_ID: ${{ steps.op-credentials.outputs.FLEEK_PROJECT_ID}}
- name: Get the Fleek output url
run: echo "The Fleek deploy url is ${{ steps.deploy.outputs.deployUrl }}"
####################
# Send info to APM #
####################
- name: Upload sourcemap to Kibana sourcemap endpoint (APM)
env:
COMMIT_SHA: ${{ github.sha }}
run: |
for f in $(find ./dist/assets/ -name *.js.map) ; do
curl -X POST "https://kibana-sourcemaps.aragon.org/api/apm/sourcemaps" \
-H 'Content-Type: multipart/form-data' \
-H 'kbn-xsrf: true' \
-H 'Authorization: ApiKey ${{ secrets.APM_API_KEY }}' \
-F service_name="zaragoza" \
-F service_version="$COMMIT_SHA" \
-F bundle_filepath="http://localhost/assets/$(basename $f)" \
-F sourcemap=@$f
done