Skip to content

fix: build

fix: build #2

name: add to ccswapbuilds
on:
push:
branches-ignore:
- "main"
- "develop"
- "gh-pages"
jobs:
ccswapBuild:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: set node version
uses: actions/setup-node@v2
with:
node-version: "18"
- run: yarn install
- run: yarn build
- name: Deploy to S3
if: github.base_ref == ''
env:
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_KEY}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET}}
VIRUS_TOTAL_API_KEY: ${{secrets.VIRUS_TOTAL_API_KEY}}
GITHUB_TOKEN: ${{secrets.MEW_BOT_API_KEY}}
run: |
pip install --user awscli
aws s3 sync --delete --acl public-read dist/ s3://ethvm-front-end-builds/builds/$GITHUB_SHA
aws s3 cp s3://ethvm-front-end-builds/builds/$GITHUB_SHA/index.html s3://ethvm-front-end-builds/builds/$GITHUB_SHA/index.html \
--metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate \
--content-type text/html --acl public-read
cd dist && zip -r ../ethVM-$GITHUB_SHA.zip * && cd ..
VIRUS_TOTAL_URL=`curl -s -F "file=@ethVM-$GITHUB_SHA.zip" -F apikey=${VIRUS_TOTAL_API_KEY} https://www.virustotal.com/vtapi/v2/file/scan | jq --raw-output '.permalink'`
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
-d "{\"body\": \"Copy of this build can be found at <br/>https://builds.ethvm.dev/${GITHUB_SHA}/index.html<br/> \
Virus Total analysis <br/> \
$VIRUS_TOTAL_URL\"}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/comments"