Skip to content

Commit 9b0c10c

Browse files
committed
Still some broken stuff
1 parent 69b5c69 commit 9b0c10c

38 files changed

+65563
-16253
lines changed

.eslintrc.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
const env_vars = require('./ENV_VARS');
21
module.exports = {
3-
globals: env_vars,
2+
globals: {
3+
VERSION: 'readonly',
4+
ROUTER_MODE: 'readonly',
5+
BUILD_TYPE: 'readonly',
6+
NODE_ENV: 'readonly'
7+
},
48
root: true,
59
env: {
610
node: true
@@ -21,7 +25,9 @@ module.exports = {
2125
'prefer-const': 'error',
2226
'no-var': 'error',
2327
'security/detect-new-buffer': 'off',
24-
'security/detect-object-injection': 'off'
28+
'security/detect-object-injection': 'off',
29+
'require-atomic-updates': 'off',
30+
'no-prototype-builtins': 'off'
2531
},
2632
parserOptions: {
2733
parser: 'babel-eslint'

.github/workflows/add-to-codecov.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: add to codecov
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'gh-pages'
7+
- 'gh-pages-history'
8+
tags-ignore:
9+
- '*'
10+
11+
jobs:
12+
codecov:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: setup env
18+
run: |
19+
docker build -t mew-build-container .
20+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
21+
22+
- name: Cache node modules
23+
uses: actions/cache@v1
24+
env:
25+
cache-name: cache-node-modules
26+
with:
27+
path: node_modules
28+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
31+
32+
- name: npm install
33+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
34+
35+
- name: add to codecov
36+
run: |
37+
ci_env='-e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID'
38+
docker run $ci_env --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run codecov"
39+
40+
- name: upload to codecov
41+
uses: codecov/codecov-action@v1
42+
with:
43+
fail_ci_if_error: true

.github/workflows/add-to-develop.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: add to develop
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
develop-build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: setup env
15+
run: |
16+
docker build -t mew-build-container .
17+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
18+
19+
- name: Cache node modules
20+
uses: actions/cache@v1
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
path: node_modules
25+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
28+
29+
- name: npm install
30+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
31+
32+
- name: build
33+
run: docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run build:history"
34+
35+
- name: add to develop
36+
env:
37+
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
38+
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
39+
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
40+
run: |
41+
pip install --user awscli
42+
aws s3 sync dist/ s3://mewbuilds/develop/ --delete --cache-control max-age=172800,public \
43+
--acl public-read
44+
aws s3 cp s3://mewbuilds/develop/service-worker.js s3://mewbuilds/develop/service-worker.js \
45+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
46+
--content-type application/javascript --acl public-read
47+
aws s3 cp s3://mewbuilds/develop/index.html s3://mewbuilds/develop/index.html \
48+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
49+
--content-type text/html --acl public-read
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: add to mewbuilds
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'gh-pages'
7+
- 'gh-pages-history'
8+
tags-ignore:
9+
- '*'
10+
11+
jobs:
12+
mewbuilds:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: setup env
18+
run: |
19+
docker build -t mew-build-container .
20+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
21+
22+
- name: Cache node modules
23+
uses: actions/cache@v1
24+
env:
25+
cache-name: cache-node-modules
26+
with:
27+
path: node_modules
28+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
31+
32+
- name: npm install
33+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
34+
35+
- name: build
36+
run: docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run build:hash"
37+
38+
- name: post build
39+
if: github.base_ref == ''
40+
env:
41+
IPFS_NODE: ${{secrets.IPFS_NODE}}
42+
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
43+
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
44+
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
45+
VIRUS_TOTAL_API_KEY: ${{secrets.VIRUS_TOTAL_API_KEY}}
46+
GITHUB_TOKEN: ${{secrets.MEW_BOT_TOKEN}}
47+
run: |
48+
pip install --user awscli
49+
mkdir -p ~/.ssh
50+
ssh-keyscan -H $IPFS_NODE >> $HOME/.ssh/known_hosts
51+
openssl aes-256-cbc -K ${{secrets.FILE_DECRYPT_KEY}} -iv ${{secrets.FILE_DECRYPT_IV}} -in ssh-keys.tar.enc -out ssh-keys.tar -d
52+
tar xvf ssh-keys.tar
53+
chmod 400 ipfs-host.pem
54+
hashOut=`tar -cjvf - -C dist/ . | ssh -i ipfs-host.pem ubuntu@$IPFS_NODE ./ipfs-publish.sh --`
55+
HASH=`echo $hashOut | sed -n 's:.*<hash>\(.*\)</hash>.*:\1:p'`
56+
aws s3 sync --delete --acl public-read dist/ s3://mewbuilds/build/$GITHUB_SHA
57+
aws s3 cp s3://mewbuilds/build/$GITHUB_SHA/service-worker.js s3://mewbuilds/build/$GITHUB_SHA/service-worker.js \
58+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
59+
--content-type application/javascript --acl public-read
60+
aws s3 cp s3://mewbuilds/build/$GITHUB_SHA/index.html s3://mewbuilds/build/$GITHUB_SHA/index.html \
61+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
62+
--content-type text/html --acl public-read
63+
cd dist && zip -r ../MyEtherWallet-$GITHUB_SHA.zip * && cd ..
64+
VIRUS_TOTAL_URL=`curl -s -F "file=@MyEtherWallet-$GITHUB_SHA.zip" -F apikey=${VIRUS_TOTAL_API_KEY} https://www.virustotal.com/vtapi/v2/file/scan | jq --raw-output '.permalink'`
65+
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
66+
-d "{\"body\": \"Copy of this build can be found at <br/>https://www.mewbuilds.com/build/${GITHUB_SHA}/index.html<br/> \
67+
https://www.cloudflare-ipfs.com/ipfs/$HASH <br/> \
68+
Virus Total analysis <br/> \
69+
$VIRUS_TOTAL_URL\"}" \
70+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/comments"

.github/workflows/deploy-live.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: deploy live
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
gh-pages:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
ref: master
15+
16+
- name: verify tag
17+
run: |
18+
echo $GITHUB_SHA
19+
git branch --contains $GITHUB_SHA
20+
git branch --contains $GITHUB_SHA | sed -e 's/^[ \t *]*//' | grep '^master$'
21+
git checkout $GITHUB_SHA
22+
23+
- name: setup env
24+
run: |
25+
docker build -t mew-build-container .
26+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
27+
28+
- name: Cache node modules
29+
uses: actions/cache@v1
30+
env:
31+
cache-name: cache-node-modules
32+
with:
33+
path: node_modules
34+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
37+
38+
- name: npm install
39+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
40+
41+
- name: build
42+
run: docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run build:history"
43+
44+
- name: deploy to production
45+
env:
46+
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
47+
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
48+
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
49+
run: |
50+
pip install --user awscli
51+
aws s3 sync dist/ s3://mewbuilds/staging/ --delete --cache-control max-age=172800,public \
52+
--acl public-read
53+
aws s3 cp s3://mewbuilds/staging/service-worker.js s3://mewbuilds/staging/service-worker.js \
54+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
55+
--content-type application/javascript --acl public-read
56+
aws s3 cp s3://mewbuilds/staging/index.html s3://mewbuilds/staging/index.html \
57+
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
58+
--content-type text/html --acl public-read
59+
60+
- name: deploy to gh-pages-history
61+
uses: JamesIves/github-pages-deploy-action@releases/v3
62+
with:
63+
ACCESS_TOKEN: ${{ secrets.MEW_BOT_TOKEN }}
64+
BRANCH: gh-pages-history
65+
FOLDER: dist
66+
CLEAN: true
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: deploy to gh-pages
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
gh-pages:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
ref: master
15+
16+
- name: verify tag
17+
run: |
18+
git branch --contains $GITHUB_SHA | sed -e 's/^[ \t *]*//' | grep '^master$'
19+
git checkout $GITHUB_SHA
20+
21+
- name: setup env
22+
run: |
23+
docker build -t mew-build-container .
24+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
25+
26+
- name: Cache node modules
27+
uses: actions/cache@v1
28+
env:
29+
cache-name: cache-node-modules
30+
with:
31+
path: node_modules
32+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
33+
restore-keys: |
34+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
35+
36+
- name: npm install
37+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
38+
39+
- name: build
40+
run: docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run build:hash"
41+
42+
- name: deploy to gh-pages
43+
uses: JamesIves/github-pages-deploy-action@releases/v3
44+
with:
45+
ACCESS_TOKEN: ${{ secrets.MEW_BOT_TOKEN }}
46+
BRANCH: gh-pages
47+
FOLDER: dist
48+
CLEAN: true

.github/workflows/generate-cx-zip.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: generate cx zip
2+
3+
on:
4+
push:
5+
branches:
6+
- '**cx**'
7+
8+
jobs:
9+
develop-build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: setup env
15+
run: |
16+
docker build -t mew-build-container .
17+
echo ::set-env name=NODE_VERSION::$(docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "node --version")
18+
19+
- name: Cache node modules
20+
uses: actions/cache@v1
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
path: node_modules
25+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-build-${{ env.cache-name }}-${{env.NODE_VERSION}}-
28+
29+
- name: npm install
30+
run: docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" mew-build-container /bin/bash -c "npm install"
31+
32+
- name: build
33+
run: docker run --rm -v `pwd`:/home:rw mew-build-container /bin/bash -c "npm run build:mewcx"
34+
35+
- name: generate zip for cx
36+
env:
37+
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
38+
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
39+
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
40+
GITHUB_TOKEN: ${{secrets.MEW_BOT_TOKEN}}
41+
run: |
42+
pip install --user awscli
43+
cd chrome-extension && zip -r ../MEW-CX-$GITHUB_SHA.zip * && cd ..
44+
aws s3 cp --acl public-read ./MEW-CX-$GITHUB_SHA.zip s3://mewbuilds/cx/MEW-CX-$GITHUB_SHA.zip
45+
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
46+
-d "{\"body\": \"Copy of this build can be found at <br/>https://www.mewbuilds.com/cx/MEW-CX-${GITHUB_SHA}.zip<br/> \"}" \
47+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/comments"

0 commit comments

Comments
 (0)