refactor: remove commented code #411
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy temporary instance | |
on: | |
push: | |
branches: | |
- feat/** | |
- feature/** | |
- fix/** | |
- hotfix/** | |
- docs/** | |
- style/** | |
- refactor/** | |
- perf/** | |
- test/** | |
- build/** | |
- ci/** | |
- chore/** | |
- revert/** | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.HYPHA_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.HYPHA_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: eu-west-1 | |
NODE_ENV: development | |
BRANCH_PR_NUMBER: ${{ github.event.number }} | |
APP_NAME: 'Hypha DHO' | |
NETWORK_CHAIN_ID: ${{ vars.NETWORK_CHAIN_ID }} | |
DAO_CONTRACT: ${{ vars.DAO_CONTRACT }} | |
HYPHA_CONTRACT: ${{ vars.HYPHA_CONTRACT }} | |
SUPPLY_CONTRACT: ${{ vars.SUPPLY_CONTRACT }} | |
MULTISIG_CONTRACT: ${{ vars.MULTISIG_CONTRACT }} | |
KV_CONTRACT: ${{ vars.KV_CONTRACT }} | |
PPP_ENV: ${{ vars.PPP_ENV }} | |
ACCOUNT_API_URL: ${{ vars.ACCOUNT_API_URL }} | |
ACCOUNT_API_KEY: ${{ secrets.ACCOUNT_API_KEY }} | |
BLOCKCHAIN_ENDPOINTS: ${{ vars.BLOCKCHAIN_ENDPOINTS }} | |
BLOCKCHAIN_EXPLORER: ${{ vars.BLOCKCHAIN_EXPLORER }} | |
BLOCKCHAIN_EXPLORER_BTC: ${{ vars.BLOCKCHAIN_EXPLORER_BTC }} | |
BLOCKCHAIN_EXPLORER_ETH: ${{ vars.BLOCKCHAIN_EXPLORER_ETH }} | |
BLOCKCHAIN_EXPLORER_EOS: ${{ vars.BLOCKCHAIN_EXPLORER_EOS }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
DOCUMENTATION: ${{ vars.DOCUMENTATION }} | |
DGRAPH_URL: ${{ vars.DGRAPH_URL }} | |
DGRAPH_ROOT_HASH: ${{ vars.DGRAPH_ROOT_HASH }} | |
DGRAPH_AUTH_KEY: ${{ secrets.DGRAPH_AUTH_KEY }} | |
GRAPHQL_URI: ${{vars.GRAPHQL_URI}} | |
ROOT_DAO_ID: ${{vars.ROOT_DAO_ID}} | |
ELASTIC_SEARCH_URL: ${{ vars.ELASTIC_SEARCH_URL }} | |
ELASTIC_SEARCH_API_KEY: ${{ secrets.ELASTIC_SEARCH_API_KEY }} | |
IPFS_URL: ${{ secrets.IPFS_URL }} | |
IPFS_PROJECT_ID: ${{ secrets.IPFS_PROJECT_ID }} | |
IPFS_PROJECT_SECRET: ${{ secrets.IPFS_PROJECT_SECRET }} | |
IPFS_GATEWAY: ${{ secrets.IPFS_GATEWAY }} | |
HYPHA_TOKEN_SALES_ENCODE_KEY: ${{ secrets.HYPHA_TOKEN_SALES_ENCODE_KEY }} | |
HYPHA_TOKEN_SALES_URL: ${{ vars.HYPHA_TOKEN_SALES_URL }} | |
HYPHA_TOKEN_SALES_API_URL: ${{ vars.HYPHA_TOKEN_SALES_API_URL }} | |
HYPHA_TOKEN_SALES_RPC_URL: ${{ vars.HYPHA_TOKEN_SALES_RPC_URL }} | |
CAPTCHA_PUBLIC_KEY: ${{ vars.CAPTCHA_PUBLIC_KEY }} | |
CAPTCHA_HOST: ${{ vars.CAPTCHA_HOST }} | |
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }} | |
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }} | |
DOWNLOAD_WALLET_LINK_IOS: ${{vars.DOWNLOAD_WALLET_LINK_IOS}} || http://itunes.apple.com/lb/app/id1659926348 | |
DOWNLOAD_WALLET_LINK_ANDROID: ${{vars.DOWNLOAD_WALLET_LINK_ANDROID}} || http://play.google.com/store/apps/details?id=earth.hypha.wallet.hypha_wallet | |
jobs: | |
build_and_deploy: | |
name: 'Build and Deploy App' | |
environment: telosTestNet | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Generate branch name | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Create S3 bucket | |
run: | | |
if aws s3api head-bucket --bucket ${{ env.BRANCH_NAME }} 2>/dev/null; then | |
echo "Bucket exists" | |
else | |
aws s3 mb s3://${{ env.BRANCH_NAME }} --region ${{ env.AWS_REGION }} | |
echo "Bucket created" | |
fi | |
- name: Check CloudFront Distribution | |
run: | | |
DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[0]=='${{ env.BRANCH_NAME }}'].Id" --output text) | |
if [ -z "$DISTRIBUTION_ID" ] | |
then | |
echo "Creating CloudFront distribution" | |
aws cloudfront create-distribution \ | |
--origin-domain-name ${{ env.BRANCH_NAME }}.s3.amazonaws.com \ | |
--default-root-object index.html | |
else | |
echo "CloudFront distribution exists with ID: $DISTRIBUTION_ID" | |
echo "::set-output name=cf-dist-id::$DISTRIBUTION_ID" | |
fi | |
- name: Get CloudFront Distribution DNS Name | |
id: get_cf_dns_name | |
run: | | |
echo "::set-output name=distribution_dns_name::$(aws cloudfront get-distribution-config --id ${{ steps.create_cloudfront.outputs.cloudfront_distribution_id }} --query 'DistributionConfig.ViewerCertificate.ACMCertificateArn' --output text | cut -d '/' -f 2)" | |
- name: Create CNAME entry | |
if: steps.get_cf_dns_name.outputs.distribution_dns_name != '' | |
run: | | |
echo ${{ env.BRANCH_NAME }} ${{ steps.get_cf_dns_name.outputs.distribution_dns_name }} >> /etc/hosts | |
aws route53 change-resource-record-sets --hosted-zone-id ${{ env.AWS_HOSTED_ZONE_ID }} --change-batch '{"Changes":[{"Action":"UPSERT","ResourceRecordSet":{"Name":"${env.BRANCH_NAME}.","Type":"CNAME","TTL":300,"ResourceRecords":[{"Value":"${steps.get_cf_dns_name.outputs.distribution_dns_name}"}]}}]}' | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16.x' | |
- run: yarn global add @vue/cli@latest | |
- run: yarn install | |
- run: mv public/chain-manifests-prod.json public/chain-manifests.json | |
- run: mv public/app-manifest-prod.json public/app-manifest.json | |
- run: yarn build | |
- name: S3 sync | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ env.BRANCH_NAME }} | |
AWS_REGION: ${{ env.AWS_REGION }} | |
SOURCE_DIR: 'dist/spa' |