Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates NEWM tools deployments #659

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
run: |
npm install --prefix .github/workflows/cdk
sed -i 's|const nextConfig = .*|const nextConfig = { basePath: "/wallet-connect", |' apps/mobile-wallet-connector/next.config.js
APPNAME=mobile-wallet-connector APPID=MobileWalletConnector QUALIFIER=Garage NEXT_PUBLIC_ENV=staging NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING=${{ secrets.RECAPTCHA_SITE_KEY_STAGING }} npm run --prefix .github/workflows/cdk cdk:deploy deploy -- --require-approval never
APPNAME=mobile-wallet-connector APPID=MobileWalletConnector QUALIFIER=Garage NEXT_PUBLIC_ENV=production NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING=${{ secrets.RECAPTCHA_SITE_KEY_STAGING }} npm run --prefix .github/workflows/cdk cdk:deploy deploy -- --require-approval never
11 changes: 1 addition & 10 deletions .github/workflows/aws-hosting-merge-deploy-newm-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npx nx build tools
env:
NEXT_PUBLIC_APPLE_CLIENT_ID: ${{ secrets.APPLE_CLIENT_ID }}
NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
NEXT_PUBLIC_GA_STUDIO_ID: ${{ secrets.GA_STUDIO_ID }}
NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING: ${{ secrets.RECAPTCHA_SITE_KEY_STAGING }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_ENV: staging

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -46,4 +37,4 @@ jobs:
- name: Deploy to Lambda Function
run: |
npm install --prefix .github/workflows/cdk
APPNAME=tools APPID=Tools QUALIFIER=Garage NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING=${{ secrets.RECAPTCHA_SITE_KEY_STAGING }} npm run --prefix .github/workflows/cdk cdk:deploy deploy -- --require-approval never
APPNAME=tools APPID=Tools QUALIFIER=Garage NEXT_PUBLIC_ENV=production NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING=${{ secrets.RECAPTCHA_SITE_KEY_STAGING }} npm run --prefix .github/workflows/cdk cdk:deploy deploy -- --require-approval never
11 changes: 1 addition & 10 deletions .github/workflows/aws-hosting-pull-request-newm-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npx nx build tools
env:
NEXT_PUBLIC_APPLE_CLIENT_ID: ${{ secrets.APPLE_CLIENT_ID }}
NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
NEXT_PUBLIC_GA_STUDIO_ID: ${{ secrets.GA_STUDIO_ID }}
NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING: ${{ secrets.RECAPTCHA_SITE_KEY_STAGING }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_ENV: staging

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -44,7 +35,7 @@ jobs:
- name: Deploy to Lambda Function
run: |
npm install --prefix .github/workflows/cdk
APPNAME=tools QUALIFIER=${{ github.event.pull_request.number }} npm run --prefix .github/workflows/cdk cdk:preview deploy -- --require-approval never
APPNAME=tools QUALIFIER=${{ github.event.pull_request.number }} NEXT_PUBLIC_ENV=staging NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING=${{ secrets.RECAPTCHA_SITE_KEY_STAGING }} npm run --prefix .github/workflows/cdk cdk:preview deploy -- --require-approval never

- name: Get preview url
id: previewurl
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cdk/bin/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const appName = process.env.APPNAME || "APPNAME";
const appId = process.env.APPID || "APPID";
const qualifier = process.env.QUALIFIER || "UNDEFINED";
const recaptchaKey = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING || "";
const appEnv = process.env.NEXT_PUBLIC_ENV || "";
const rootDir = path.resolve(__dirname, "..", "..", "..", "..");

class WebDeployStack extends cdk.Stack {
Expand All @@ -24,6 +25,7 @@ class WebDeployStack extends cdk.Stack {
code: lambda.DockerImageCode.fromImageAsset(rootDir, {
buildArgs: {
NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING: recaptchaKey,
NEXT_PUBLIC_ENV: appEnv,
},
file: path.join("apps", appName, "Dockerfile"),
}),
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cdk/bin/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const appName = process.env.APPNAME || "APPNAME";
const appNameAbbr = appName.replace(/-/g, "");
const qualifier = process.env.QUALIFIER || "UNDEFINED";
const recaptchaKey = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING || "";
const appEnv = process.env.NEXT_PUBLIC_ENV || "";
const rootDir = path.resolve(__dirname, "..", "..", "..", "..");

class WebPreviewStack extends cdk.Stack {
Expand All @@ -21,6 +22,7 @@ class WebPreviewStack extends cdk.Stack {
{
code: lambda.DockerImageCode.fromImageAsset(rootDir, {
buildArgs: {
NEXT_PUBLIC_ENV: appEnv,
NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING: recaptchaKey,
},
file: path.join("apps", appName, "Dockerfile"),
Expand Down
3 changes: 3 additions & 0 deletions apps/tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ WORKDIR /usr/src/app
COPY --chown=node:node --from=deps /usr/src/app/node_modules ./node_modules
COPY --chown=node:node ./ ./

ARG NEXT_PUBLIC_ENV
ARG NEXT_PUBLIC_RECAPTCHA_SITE_KEY_STAGING

# Build the production app
RUN npx nx build tools

Expand Down
Loading