|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | # -------------------------------------------------------------------- |
4 | | -# Publishes a small test site that uses the packages/web3/dist/min |
| 4 | +# Prepares a small test site that uses the packages/web3/dist/min |
5 | 5 | # -------------------------------------------------------------------- |
6 | 6 |
|
7 | 7 | if [ -z "$CI" ]; then |
8 | 8 |
|
9 | 9 | echo "======================================================================" |
10 | | - echo "This script publishes a test site with surge.sh. Only run in CI." |
| 10 | + echo "This script prepares a test site for Netlify. Only run in CI. " |
11 | 11 | echo "======================================================================" |
12 | 12 |
|
13 | 13 | exit 1 |
14 | 14 |
|
15 | 15 | fi |
16 | 16 |
|
17 | 17 | echo "======================================================================" |
18 | | -echo "Publishing test site with surge.sh. See link below. " |
| 18 | +echo "Preparing test site for web3-staging.netlify.app " |
19 | 19 | echo "======================================================================" |
20 | 20 |
|
21 | | -# Mark file with current commit and branch |
22 | | -sed -i "s|__COMMIT_HASH__|$GITHUB_SHA|g" scripts/html/index.html |
23 | | -sed -i "s|__BRANCH__|$GITHUB_REF|g" scripts/html/index.html |
24 | | - |
25 | 21 | cp packages/web3/dist/web3.min.js scripts/html |
26 | | -cd scripts |
27 | | -(echo "" && exit && cat ) | npx surge --domain sudden-playground.surge.sh html |
28 | 22 |
|
29 | | -# Might be running locally in development |
30 | | -rm html/web3.min.js |
| 23 | +cd scripts/html |
| 24 | + |
| 25 | +BUNDLE_SIZE=$(wc -c web3.min.js | awk '{print $1}') |
| 26 | + |
| 27 | +# Mark file with current commit, branch, and bundle size. |
| 28 | +sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" index.html |
| 29 | +sed -i "s|__BRANCH__|$BRANCH|g" index.html |
| 30 | +sed -i "s|__BUNDLE_SIZE__|$BUNDLE_SIZE|g" index.html |
31 | 31 |
|
32 | | -# Sometimes surge.sh fails with an auth error because it's generated a name which |
33 | | -# is already taken (or something?) This test is just meant to be a visual |
34 | | -# inspection check if/when there are doubts - we don't want it crash CI alot. |
35 | | -exit 0 |
0 commit comments