From 22817607f7bbb0602355974de6289f553b47262a Mon Sep 17 00:00:00 2001 From: AustinZhu <42071208+AustinZhu@users.noreply.github.com> Date: Fri, 12 Nov 2021 23:40:00 +0900 Subject: [PATCH] amplify: add envvar Signed-off-by: AustinZhu <42071208+AustinZhu@users.noreply.github.com> --- .github/workflows/deploy.yml | 2 +- README.md | 2 +- lib/configs/amplify/build-setting.ts | 6 +++--- lib/constructs/presentation/web-app.ts | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a400d780d..6f7983dbd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -22,7 +22,7 @@ env: BIT_TOKEN: ${{ secrets.BIT_TOKEN }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEPLOY_KEY: ${{ secrets.FEEDS_DEPLOY_PRIVATE_KEY }} + FEEDS_DEPLOY_PRIVATE_KEY: ${{ secrets.FEEDS_DEPLOY_PRIVATE_KEY }} STAGE: dev # A workflow run is made up of one or more jobs that can run sequentially or in parallel diff --git a/README.md b/README.md index 4f48ff854..877837354 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WasedaTime Backend -![AWS CDK CI/CD](https://github.com/wasedatime/wasedatime-backend/workflows/AWS%20CDK%20CI/CD/badge.svg) +[![AWS CDK CI/CD](https://github.com/wasedatime/wasedatime-backend/actions/workflows/deploy.yml/badge.svg)](https://github.com/wasedatime/wasedatime-backend/actions/workflows/deploy.yml) ![](https://img.shields.io/website?up_color=green&up_message=online&url=https%3A%2F%2Fwasedatime.com) This repository defines the serverless application architecture, resource configuration and infrastructure provision strategy of diff --git a/lib/configs/amplify/build-setting.ts b/lib/configs/amplify/build-setting.ts index 46f9cab2a..01ec32241 100644 --- a/lib/configs/amplify/build-setting.ts +++ b/lib/configs/amplify/build-setting.ts @@ -3,6 +3,7 @@ import {microAppCorsHeader, securityHeaders} from "./website"; export const bitToken = process.env.BIT_TOKEN!; +export const feedsDeployKey = process.env.FEEDS_DEPLOY_PRIVATE_KEY!; const preBuild = { commands: [ @@ -14,11 +15,10 @@ const preBuild = { const preBuildForFeeds = { commands: [ "eval $(ssh-agent -s)", - "ssh-add <(echo \"$DEPLOY_KEY\" | base64 --decode)", + "ssh-add <(echo \"$FEEDS_DEPLOY_PRIVATE_KEY\" | base64 --decode)", "git submodule init", "git submodule update --remote", - "yum check-update", - "yum -y install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig", + "yum -y install make nasm autoconf automake libtool dpkg pkgconfig libpng libpng-dev g++", "npm install -g pnpm", "pnpm install --filter .", ], diff --git a/lib/constructs/presentation/web-app.ts b/lib/constructs/presentation/web-app.ts index 699da9a2f..5fdc945dd 100644 --- a/lib/constructs/presentation/web-app.ts +++ b/lib/constructs/presentation/web-app.ts @@ -2,7 +2,7 @@ import * as cdk from "@aws-cdk/core"; import {App, Branch, CustomRule, Domain, RedirectStatus} from "@aws-cdk/aws-amplify"; import {developerAuth} from "../../configs/amplify/website"; -import {bitToken, microAppBuildSpec, microAppDevBuildSpec} from "../../configs/amplify/build-setting"; +import {bitToken, feedsDeployKey, microAppBuildSpec, microAppDevBuildSpec} from "../../configs/amplify/build-setting"; import {webAppCode} from "../../configs/amplify/codebase"; import {ROOT_DOMAIN} from "../../configs/route53/domain"; @@ -54,6 +54,7 @@ export class AmplifyMonoWebApp extends AbstractWebApp { "REACT_APP_OAUTH_URL": `https://${props.authDomain}`, "NODE_OPTIONS": "--max-old-space-size=8192", "BIT_TOKEN": bitToken, + "FEEDS_DEPLOY_PRIVATE_KEY": feedsDeployKey, }, sourceCodeProvider: webAppCode, autoBranchCreation: {