Merge pull request #1019 from InjectiveLabs/dev #54
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: Helix Mainnet Deployments | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
mainnet: | |
if: true | |
name: 'Deploy to mainnet' | |
env: | |
## Public | |
VITE_NAME: 'Helix | The Premier Decentralized Spot and Derivatives Exchange' | |
VITE_BASE_URL: https://helixapp.com | |
VITE_NETWORK: mainnet | |
VITE_ENV: mainnet | |
VITE_CHAIN_ID: injective-1 | |
VITE_ETHEREUM_CHAIN_ID: 1 | |
SOURCE_DIR: .output/public | |
DEST_DIR: www | |
## Github Actions | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
## Flags | |
VITE_MAINTENANCE_ENABLED: false | |
VITE_GEO_IP_RESTRICTIONS_ENABLED: true | |
VITE_BANNER_NOTICE_ENABLED: false | |
## Endpoints | |
VITE_INDEXER_API_ENDPOINT: '' | |
VITE_CHRONOS_API_ENDPOINT: '' | |
VITE_EXPLORER_API_ENDPOINT: '' | |
VITE_SENTRY_GRPC_ENDPOINT: '' | |
VITE_SENTRY_REST_ENDPOINT: '' | |
## Secret | |
VITE_FEE_PAYER_PUB_KEY: ${{ secrets.VITE_FEE_PAYER_PUB_KEY }} | |
VITE_ALCHEMY_KEY: ${{ secrets.VITE_ALCHEMY_KEY }} | |
VITE_AMPLITUDE_KEY: ${{ secrets.VITE_AMPLITUDE_KEY }} | |
VITE_BUGSNAG_KEY: ${{ secrets.VITE_BUGSNAG_KEY }} | |
VITE_MIXPANEL_KEY: ${{ secrets.VITE_MIXPANEL_KEY }} | |
VITE_COINGECKO_API_KEY: ${{ secrets.VITE_COINGECKO_API_KEY }} | |
VITE_FEE_RECIPIENT: ${{ secrets.VITE_FEE_RECIPIENT }} | |
VITE_GOOGLE_ANALYTICS_KEY: ${{ secrets.VITE_GOOGLE_ANALYTICS_KEY }} | |
VITE_HOTJAR_KEY: ${{ secrets.VITE_HOTJAR_KEY }} | |
VITE_GOOGLE_SITE_VERIFICATION_KEY: ${{ secrets.VITE_GOOGLE_SITE_VERIFICATION_KEY }} | |
VITE_NEWSLETTER_API: ${{ secrets.VITE_NEWSLETTER_API }} | |
VITE_NINJA_PASS_ENDPOINT: ${{ secrets.VITE_NINJA_PASS_ENDPOINT }} | |
VITE_PROXY_DETECTION_API_KEY: ${{ secrets.VITE_PROXY_DETECTION_API_KEY }} | |
VITE_SHEETDB_BEARER_TOKEN: ${{ secrets.VITE_SHEETDB_BEARER_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_MAINNET_BUCKET }} | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_MAINNET_DISTRIBUTION_ID }} | |
AWS_REGION: ${{ secrets.AWS_MAINNET_REGION }} | |
NODE_OPTIONS: '--max_old_space_size=15360' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Using Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- name: Setup libudev-dev | |
run: | | |
sudo apt-get update | |
sudo apt-get install libudev-dev | |
- name: Remove prev build | |
run: yarn clean-up | |
- name: Install Dependencies | |
run: yarn install --force --ignore-engines | |
- name: Generating the static pages | |
run: yarn generateNoSourceMap | |
- name: Use AWS CLI | |
uses: chrislennon/[email protected] | |
- name: Sync to S3 bucket | |
run: aws s3 sync dist/ s3://$AWS_S3_BUCKET/www --follow-symlinks --delete | |
- name: Set Cache Headers | |
run: aws s3 cp s3://$AWS_S3_BUCKET/www s3://$AWS_S3_BUCKET/www --exclude "*" --include "*.js" --include "*.css" --include "*.svg" --include "*.woff2" --include "*.woff" --include "*.ttf" --recursive --metadata-directive REPLACE --expires 2034-01-01T00:00:00Z --cache-control max-age=2592000,public | |
- name: Invalidate Cloudfront CDN | |
run: aws cloudfront create-invalidation --distribution-id=$CLOUDFRONT_DISTRIBUTION_ID --paths "/*" | |
notify_slack_on_success: | |
runs-on: ubuntu-latest | |
needs: [mainnet] | |
if: always() && (needs.mainnet.result == 'success') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: "Notify Slack" | |
run: | | |
git fetch origin master | |
payload='{ | |
"text": "'"<!here> Helix - Deployed to Mainnet!.\n View the deployment results on Github: https://github.com/InjectiveLabs/injective-helix/actions/runs/${{ github.run_id }}.\n The commits deployed are:\n $(git log remotes/origin/master..HEAD --pretty=format:'%h - %s')"'", | |
"attachments": [ | |
{ | |
"text": "Helix deployed to Mainnet ✅", | |
"color": "#22bb33" | |
} | |
] | |
}' | |
curl -X POST -H 'Content-type: application/json' --data "${payload}" https://hooks.slack.com/services/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 |