Skip to content

feat(platform): disabled welcome emails for K33 and K33 Research #90

feat(platform): disabled welcome emails for K33 and K33 Research

feat(platform): disabled welcome emails for K33 and K33 Research #90

name: Canary deploy to GCP
on:
workflow_dispatch:
push:
branches:
- main
env:
IMAGE: europe-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/backend/k33-backend
jobs:
build-push-deploy:
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- name: Checkout the Repository
uses: actions/checkout@v3
- name: Setup jdk 20
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "21.0.3"
cache: "gradle"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Load secrets
uses: 1password/load-secrets-action@v1
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
GCP_PROJECT_ID: op://env/prod/gcp/GCP_PROJECT_ID
# stripe
STRIPE_PRODUCT_ID_RESEARCH_TWIC: op://env/prod/stripe/STRIPE_PRODUCT_ID_RESEARCH_TWIC
STRIPE_PRODUCT_ID_RESEARCH_NN: op://env/prod/stripe/STRIPE_PRODUCT_ID_RESEARCH_NN
STRIPE_PRODUCT_ID_RESEARCH_AOC: op://env/prod/stripe/STRIPE_PRODUCT_ID_RESEARCH_AOC
STRIPE_PRODUCT_ID_RESEARCH_PRO: op://env/prod/stripe/STRIPE_PRODUCT_ID_RESEARCH_PRO
STRIPE_COUPON_CORPORATE_PLAN: op://env/prod/stripe/STRIPE_COUPON_CORPORATE_PLAN
# slack
SLACK_ALERTS_CHANNEL_ID: op://env/prod/slack/SLACK_ALERTS_CHANNEL_ID
SLACK_GENERAL_CHANNEL_ID: op://env/prod/slack/SLACK_GENERAL_CHANNEL_ID
SLACK_INVEST_CHANNEL_ID: op://env/prod/slack/SLACK_INVEST_CHANNEL_ID
SLACK_PRODUCT_CHANNEL_ID: op://env/prod/slack/SLACK_PRODUCT_CHANNEL_ID
SLACK_PROFESSIONAL_INVESTORS_CHANNEL_ID: op://env/prod/slack/SLACK_PROFESSIONAL_INVESTORS_CHANNEL_ID
SLACK_RESEARCH_CHANNEL_ID: op://env/prod/slack/SLACK_RESEARCH_CHANNEL_ID
SLACK_RESEARCH_EVENTS_CHANNEL_ID: op://env/prod/slack/SLACK_RESEARCH_EVENTS_CHANNEL_ID
SLACK_VAULT_ADMIN_CHANNEL_ID: op://env/prod/slack/SLACK_VAULT_ADMIN_CHANNEL_ID
# sendgrid
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH
## TWIC
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_TWIC: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_TWIC
SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_TWIC: op://env/prod/sendgrid/SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_TWIC
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_TWIC: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_TWIC
## NN
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_NN: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_NN
SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_NN: op://env/prod/sendgrid/SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_NN
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_NN: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_NN
## AOC
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_AOC: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_AOC
SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_AOC: op://env/prod/sendgrid/SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_AOC
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_AOC: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_AOC
## PRO
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO_TRIAL: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO_TRIAL
SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO
SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_PRO: op://env/prod/sendgrid/SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_PRO
SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_PRO: op://env/prod/sendgrid/SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_PRO
# lifecycle
SENDGRID_TEMPLATE_ID_CANCEL_DURING_TRIAL_K33_RESEARCH_PRO: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_CANCEL_DURING_TRIAL_K33_RESEARCH_PRO
# stripe cronjob
SENDGRID_TEMPLATE_ID_NEW_USER_OFFER_K33_RESEARCH: op://env/prod/sendgrid/SENDGRID_TEMPLATE_ID_NEW_USER_OFFER_K33_RESEARCH
# ga
GOOGLE_ANALYTICS_FIREBASE_APP_ID: op://env/prod/analytics/GOOGLE_ANALYTICS_FIREBASE_APP_ID
GOOGLE_ANALYTICS_MEASUREMENT_ID: op://env/prod/analytics/GOOGLE_ANALYTICS_MEASUREMENT_ID
# for invest app
INVEST_DENIED_COUNTRY_CODE_LIST: op://env/prod/invest/INVEST_DENIED_COUNTRY_CODE_LIST
INVEST_EMAIL_FROM: op://env/prod/invest/INVEST_EMAIL_FROM
INVEST_EMAIL_TO_LIST: op://env/prod/invest/INVEST_EMAIL_TO_LIST
INVEST_EMAIL_CC_LIST: op://env/prod/invest/INVEST_EMAIL_CC_LIST
INVEST_EMAIL_BCC_LIST: op://env/prod/invest/INVEST_EMAIL_BCC_LIST
# for vault app
## coin_gecko
COIN_GECKO_API_KEY: op://env/dev/vault/COIN_GECKO_API_KEY
# gcp
GCP_WORKLOAD_IDENTITY_PROVIDER: op://env/github/gcp/GCP_WORKLOAD_IDENTITY_PROVIDER
GCP_SERVICE_ACCOUNT: op://env/github/gcp/GCP_SERVICE_ACCOUNT
- name: Google auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.GCP_SERVICE_ACCOUNT }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.GCP_PROJECT_ID }}
- name: Authorize Docker push
run: gcloud auth configure-docker europe-docker.pkg.dev
- name: Build with Gradle
run: ./gradlew --no-daemon :apps:k33-backend:installDist --parallel
- name: Build docker image
run: docker image build -t "$IMAGE":${GITHUB_SHA::12} apps/k33-backend
- name: Push docker image
run: docker image push "$IMAGE":${GITHUB_SHA::12}
- name: Canary deploy to GCP Cloud Run
run: |-
gcloud run deploy k33-backend \
--region europe-west1 \
--image "${IMAGE}":${GITHUB_SHA::12} \
--cpu=1 \
--memory=1Gi \
--min-instances=1 \
--max-instances=1 \
--concurrency=1000 \
--set-env-vars="GCP_PROJECT_ID=${GCP_PROJECT_ID}" \
--set-env-vars="GOOGLE_CLOUD_PROJECT=${GCP_PROJECT_ID}" \
--set-env-vars="STRIPE_PRODUCT_ID_RESEARCH_TWIC=${STRIPE_PRODUCT_ID_RESEARCH_TWIC}" \
--set-env-vars="STRIPE_PRODUCT_ID_RESEARCH_NN=${STRIPE_PRODUCT_ID_RESEARCH_NN}" \
--set-env-vars="STRIPE_PRODUCT_ID_RESEARCH_AOC=${STRIPE_PRODUCT_ID_RESEARCH_AOC}" \
--set-env-vars="STRIPE_PRODUCT_ID_RESEARCH_PRO=${STRIPE_PRODUCT_ID_RESEARCH_PRO}" \
--set-env-vars="STRIPE_COUPON_CORPORATE_PLAN=${STRIPE_COUPON_CORPORATE_PLAN}" \
--set-env-vars="SLACK_ALERTS_CHANNEL_ID=${SLACK_ALERTS_CHANNEL_ID}" \
--set-env-vars="SLACK_GENERAL_CHANNEL_ID=${SLACK_GENERAL_CHANNEL_ID}" \
--set-env-vars="SLACK_INVEST_CHANNEL_ID=${SLACK_INVEST_CHANNEL_ID}" \
--set-env-vars="SLACK_PRODUCT_CHANNEL_ID=${SLACK_PRODUCT_CHANNEL_ID}" \
--set-env-vars="SLACK_PROFESSIONAL_INVESTORS_CHANNEL_ID=${SLACK_PROFESSIONAL_INVESTORS_CHANNEL_ID}" \
--set-env-vars="SLACK_RESEARCH_CHANNEL_ID=${SLACK_RESEARCH_CHANNEL_ID}" \
--set-env-vars="SLACK_RESEARCH_EVENTS_CHANNEL_ID=${SLACK_RESEARCH_EVENTS_CHANNEL_ID}" \
--set-env-vars="SLACK_VAULT_ADMIN_CHANNEL_ID=${SLACK_VAULT_ADMIN_CHANNEL_ID}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_TWIC=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_TWIC}" \
--set-env-vars="SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_TWIC=${SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_TWIC}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_TWIC=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_TWIC}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_NN=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_NN}" \
--set-env-vars="SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_NN=${SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_NN}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_NN=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_NN}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_AOC=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_AOC}" \
--set-env-vars="SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_AOC=${SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_AOC}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_AOC=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_AOC}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO_TRIAL=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO_TRIAL}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO=${SENDGRID_TEMPLATE_ID_WELCOME_TO_K33_RESEARCH_PRO}" \
--set-env-vars="SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_PRO=${SENDGRID_CONTACT_LIST_ID_K33_RESEARCH_PRO}" \
--set-env-vars="SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_PRO=${SENDGRID_UNSUBSCRIBE_GROUP_ID_K33_RESEARCH_PRO}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_CANCEL_DURING_TRIAL_K33_RESEARCH_PRO=${SENDGRID_TEMPLATE_ID_CANCEL_DURING_TRIAL_K33_RESEARCH_PRO}" \
--set-env-vars="SENDGRID_TEMPLATE_ID_NEW_USER_OFFER_K33_RESEARCH=${SENDGRID_TEMPLATE_ID_NEW_USER_OFFER_K33_RESEARCH}" \
--set-env-vars="GOOGLE_ANALYTICS_FIREBASE_APP_ID=${GOOGLE_ANALYTICS_FIREBASE_APP_ID}" \
--set-env-vars="GOOGLE_ANALYTICS_MEASUREMENT_ID=${GOOGLE_ANALYTICS_MEASUREMENT_ID}" \
--set-env-vars="^:^INVEST_DENIED_COUNTRY_CODE_LIST=${INVEST_DENIED_COUNTRY_CODE_LIST}" \
--set-env-vars="INVEST_EMAIL_FROM=${INVEST_EMAIL_FROM}" \
--set-env-vars="^:^INVEST_EMAIL_TO_LIST=${INVEST_EMAIL_TO_LIST}" \
--set-env-vars="^:^INVEST_EMAIL_CC_LIST=${INVEST_EMAIL_CC_LIST}" \
--set-env-vars="^:^INVEST_EMAIL_BCC_LIST=${INVEST_EMAIL_BCC_LIST}" \
--set-env-vars="COIN_GECKO_API_KEY=${COIN_GECKO_API_KEY}" \
--set-secrets="SENDGRID_API_KEY=SENDGRID_API_KEY:latest" \
--set-secrets="CONTENTFUL_LEGAL_SPACE_ID=CONTENTFUL_LEGAL_SPACE_ID:latest" \
--set-secrets="CONTENTFUL_LEGAL_SPACE_TOKEN=CONTENTFUL_LEGAL_SPACE_TOKEN:latest" \
--set-secrets="CONTENTFUL_RESEARCH_SPACE_ID=CONTENTFUL_RESEARCH_SPACE_ID:latest" \
--set-secrets="CONTENTFUL_RESEARCH_SPACE_TOKEN=CONTENTFUL_RESEARCH_SPACE_TOKEN:latest" \
--set-secrets="CONTENTFUL_RESEARCH_SPACE_CMA_TOKEN=CONTENTFUL_RESEARCH_SPACE_CMA_TOKEN:latest" \
--set-secrets="ALGOLIA_APP_ID=ALGOLIA_APP_ID:latest" \
--set-secrets="ALGOLIA_API_KEY=ALGOLIA_API_KEY:latest" \
--set-secrets="SLACK_BOT_TOKEN=SLACK_BOT_TOKEN:latest" \
--set-secrets="SLACK_SIGNING_SECRET=SLACK_SIGNING_SECRET:latest" \
--set-secrets="STRIPE_API_KEY=STRIPE_API_KEY:latest" \
--set-secrets="STRIPE_WEBHOOK_ENDPOINT_SECRET=STRIPE_WEBHOOK_ENDPOINT_SECRET:latest" \
--set-secrets="GOOGLE_ANALYTICS_API_SECRET=GOOGLE_ANALYTICS_API_SECRET:latest" \
--set-secrets="FIREBLOCKS_API_KEY=FIREBLOCKS_API_KEY:latest" \
--set-secrets="FIREBLOCKS_SECRET_KEY=FIREBLOCKS_SECRET_KEY:latest" \
--set-secrets="VAULT_STRIPE_API_KEY=VAULT_STRIPE_API_KEY:latest" \
--service-account k33-backend@"${GCP_PROJECT_ID}".iam.gserviceaccount.com \
--no-allow-unauthenticated \
--port=8080 \
--tag canary \
--no-traffic \
--platform=managed