Skip to content

Fix HistoricalYieldChart to ensure values are numbers for proper rend… #207

Fix HistoricalYieldChart to ensure values are numbers for proper rend…

Fix HistoricalYieldChart to ensure values are numbers for proper rend… #207

name: Deploy Earn Protocol Landing Page App Staging
on:
workflow_dispatch:
push:
branches:
- dev
jobs:
changes:
name: Check for earn protocol changes
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
permissions:
pull-requests: read
outputs:
build-earn-protocol-landing-page: ${{ steps.filter.outputs.build-earn-protocol-landing-page }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
build-earn-protocol-landing-page:
- 'apps/earn-protocol-landing-page/**'
- 'packages/app-db/**'
- 'packages/app-types/**'
- 'packages/app-earn-ui/**'
- 'packages/app-utils/**'
- 'packages/serverless-shared/**'
build-earn-protocol-landing-page:
name: Build and deploy Earn Protocol App
runs-on: ubuntu-latest
environment: staging
needs: changes
if: ${{ needs.changes.outputs.build-earn-protocol-landing-page == 'true' }}
env:
AWS_REGION: us-east-1
ENVIRONMENT_TAG: staging
SERVICE_NAME: earn-protocol-lp-2
CLUSTER_NAME: summer-fi-earn-protocol-landing-page-staging
CONFIG_URL: ${{ secrets.CONFIG_URL }}
CONFIG_URL_RAYS: ${{ secrets.CONFIG_URL_RAYS }}
MIXPANEL_KEY: ${{ secrets.MIXPANEL_KEY }}
NEXT_PUBLIC_MIXPANEL_KEY: ${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }}
SUBGRAPH_BASE: ${{ secrets.SUBGRAPH_BASE }}
NEXT_TELEMETRY_DISABLED: ${{ secrets.NEXT_TELEMETRY_DISABLED }}
SDK_API_URL: ${{ secrets.SDK_API_URL }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up turbo cache
uses: rharkor/[email protected]
- uses: pnpm/[email protected]
with:
version: 8.14.1
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Setup Earn Protocol LP App Next.js Cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/apps/earn-protocol-landing-page/.next/cache
key:
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}-${{
hashFiles('apps/earn-protocol-landing-page/**/*.ts',
'apps/earn-protocol-landing-page/**/*.tsx') }}
restore-keys:
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}-
- name: Extract commit hash
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Install dependencies
run: pnpm install
- name: Prebuild
run: pnpm prebuild
- name: Build
run: pnpm build-earn-frontend-landing
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_ID_DEV }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build docker image, copy build output and push to ECR
id: build-image
env:
LATEST_TAG: latest
ECR_REPO_NAME: summer-fi-earn-protocol-landing-page-staging
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
SHA_TAG: ${{ steps.vars.outputs.sha_short }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -f apps/earn-protocol-landing-page/docker/Dockerfile \
--build-arg CONFIG_URL=${{ secrets.CONFIG_URL }} \
--build-arg MIXPANEL_KEY=${{ secrets.MIXPANEL_KEY }} \
--build-arg NEXT_PUBLIC_MIXPANEL_KEY=${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }} \
--build-arg NEXT_TELEMETRY_DISABLED=${{ secrets.NEXT_TELEMETRY_DISABLED }} \
--build-arg SDK_API_URL=${{ secrets.SDK_API_URL }} \
--cache-from type=registry,ref=189194422115.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/buildkit-test:cache \
-t $ECR_REGISTRY/$ECR_REPO_NAME:$SHA_TAG \
-t $ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \
-t $ECR_REGISTRY/$ECR_REPO_NAME:$ENVIRONMENT_TAG \
./apps/earn-protocol-landing-page
docker push $ECR_REGISTRY/$ECR_REPO_NAME --all-tags
- name: Update ECS service with latest Docker image
id: service-update
run: |
aws ecs update-service --cluster $CLUSTER_NAME --service ${{ env.SERVICE_NAME }} --force-new-deployment --region $AWS_REGION
- name: Wait for all services to become stable
uses: oryanmoshe/[email protected]
with:
ecs-cluster: ${{ env.CLUSTER_NAME }}
ecs-services: '["${{ env.SERVICE_NAME }}"]'