Skip to content

Commit

Permalink
Merge branch 'next' into mantine-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Anton authored Jun 7, 2024
2 parents 81c21d8 + cfdb3be commit 1fbaed4
Show file tree
Hide file tree
Showing 17 changed files with 787 additions and 86 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@
"whatsappbusiness",
"xkeysib",
"zulip",
"zwnj"
"zwnj",
"prepush",
"xcodebuild"
],
"flagWords": [],
"patterns": [
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/cloud-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Release Prod
on:
workflow_dispatch:
push:
branches:
- prod

jobs:
pre-release:
runs-on: ubuntu-latest
steps:

- name: Start Deployment Notification
uses: actions/slack@master
with:
channel: '#eng-feed-deployments'
message: 'Release has started'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

release-api:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-api.yml

release-embed:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-embed.yml

release-web:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-web.yml

release-web-components:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-web-components.yml

release-webhook:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-webhook.yml

release-widget:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-widget.yml

release-worker:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-worker.yml

release-ws:
needs: [pre-release]
runs-on: ubuntu-latest
steps:
- uses: ./.github/workflows/cloud-deploy/cloud-deploy-ws.yml

post-release:
if: ${{ always() }}
needs: [
release-api,
release-embed,
release-web,
release-web-components,
release-webhook,
release-widget,
release-worker,
release-ws
]
runs-on: ubuntu-latest
steps:
- name: Deploy API Documentation
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.API_DOCS_BUILD_WEBHOOK }}
method: 'POST'

- name: Start Deployment Notification
if: ${{ failure() }} # This step runs only if any of the previous jobs fail.
uses: actions/slack@master
with:
channel: '#eng-feed-deployments'
message: 'Release has failed'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Start Deployment Notification
if: ${{ success() }} # This step runs only if all the previous jobs succeed.
uses: actions/slack@master
with:
channel: '#eng-feed-deployments'
message: 'Release has finished'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
136 changes: 136 additions & 0 deletions .github/workflows/cloud-deploy/cloud-deploy-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Deploy PROD API

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_call:

jobs:

build_prod_image:
runs-on: ubuntu-latest
timeout-minutes: 15
environment: Production
strategy:
matrix:
name: [ 'novu/api-ee' ]
outputs:
docker_image: ${{ steps.build-image.outputs.IMAGE }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: ${{ contains (matrix.name,'-ee') }}
token: ${{ secrets.SUBMODULES_TOKEN }}
- uses: ./.github/actions/setup-project
with:
submodules: ${{ contains (matrix.name,'-ee') }}

- name: build api
run: pnpm build:api

- uses: crazy-max/ghaction-setup-docker@v2
with:
version: v24.0.6
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64

- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Set Bull MQ Env variable for EE
if: contains(matrix.name, 'ee')
shell: bash
run: |
echo "BULL_MQ_PRO_NPM_TOKEN=${{ secrets.BULL_MQ_PRO_NPM_TOKEN }}" >> $GITHUB_ENV
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
REGISTRY_OWNER: novuhq
DOCKER_NAME: ${{matrix.name}}
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod,mode=max
--platform=linux/amd64
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/api && pnpm --silent --workspace-root pnpm-context -- apps/api/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/api - -t novu-api --load $DOCKER_BUILD_ARGUMENTS
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host --name api -dit --env NODE_ENV=test ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://127.0.0.1:1337/v1/health-check | grep 'ok'
docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
echo "IMAGE=ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG" >> $GITHUB_OUTPUT
deploy_prod_api_eu:
needs: build_prod_image
uses: ./.github/workflows/reusable-app-service-deploy.yml
secrets: inherit
with:
environment: Production
service_name: api
terraform_workspace: novu-prod-eu
docker_image: ghcr.io/novuhq/novu/api-ee:${{ github.sha }}

deploy_prod_api_us:
needs:
- build_prod_image
uses: ./.github/workflows/reusable-app-service-deploy.yml
secrets: inherit
with:
environment: Production
service_name: api
terraform_workspace: novu-prod
docker_image: ghcr.io/novuhq/novu/api-ee:${{ github.sha }}
deploy_sentry_release: true
sentry_project: api

newrelic:
runs-on: ubuntu-latest
name: New Relic Deploy
needs: deploy_prod_api_us
environment: Production
steps:
# This step builds a var with the release tag value to use later
- name: Set Release Version from Tag
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
# This step creates a new Change Tracking Marker
- name: New Relic Application Deployment Marker
uses: newrelic/[email protected]
with:
region: EU
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
guid: "MzgxMjQwOHxBUE18QVBQTElDQVRJT058NDk3NzA2ODk2"
version: "${{ env.RELEASE_VERSION }}"
user: "${{ github.actor }}"
28 changes: 28 additions & 0 deletions .github/workflows/cloud-deploy/cloud-deploy-embed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy PROD EMBED

on:
workflow_call:

jobs:
deploy_embed_eu:
uses: ./.github/workflows/reusable-embed-deploy.yml
with:
environment: Production
widget_url: https://eu.widget.novu.co
netlify_deploy_message: Production deployment
netlify_alias: prod
netlify_gh_env: Production
netlify_site_id: 0c830b50-df83-480b-ba36-a7f3176efcc8
secrets: inherit

deploy_embed_us:
uses: ./.github/workflows/reusable-embed-deploy.yml
with:
environment: Production
widget_url: https://widget.novu.co
netlify_deploy_message: Production deployment
netlify_alias: prod
netlify_gh_env: Production
netlify_site_id: 0689c015-fca0-4940-a26d-3e33f561bc48
secrets: inherit

40 changes: 40 additions & 0 deletions .github/workflows/cloud-deploy/cloud-deploy-web-components.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy PROD Notification Center Web Component

on:
workflow_call:

jobs:
build:
uses: ./.github/workflows/reusable-notification-center.yml

deploy_web_component:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
if: "!contains(github.event.head_commit.message, 'ci skip')"
environment: Production

steps:
- uses: actions/checkout@v4

- name: Download the artifact
uses: actions/download-artifact@v4
with:
name: notification-center-web-component
path: packages/notification-center/dist/umd

- name: Deploy Notification Center Web Component to PROD
uses: scopsy/actions-netlify@develop
with:
publish-dir: packages/notification-center/dist/umd
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: prod
production-deploy: true
alias: prod
github-deployment-environment: Production
github-deployment-description: Notification Center Web Component Deployment
netlify-config-path: packages/notification-center/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: 468165e2-bd64-4f33-9fd9-4b93ef8a0be0
timeout-minutes: 1
45 changes: 45 additions & 0 deletions .github/workflows/cloud-deploy/cloud-deploy-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

name: Deploy PROD WEB

on:
workflow_call:

jobs:

deploy_web_eu:
uses: ./.github/workflows/reusable-web-deploy.yml
with:
environment: Production
react_app_api_url: https://eu.api.novu.co
react_app_ws_url: https://eu.ws.novu.co
react_app_webhook_url: https://eu.webhook.novu.co
react_app_widget_embed_path: https://eu.embed.novu.co/embed.umd.min.js
react_app_sentry_dsn: https://[email protected]/6250907
react_app_environment: production
react_app_mail_server_domain: eu.inbound-mail.novu.co
react_app_hubspot_embed: 44416662
netlify_deploy_message: Prod deployment
netlify_alias: prod
netlify_gh_env: Production
netlify_site_id: d2e8b860-7016-4202-9256-ebca0f13259a
secrets: inherit

deploy_web_us:
needs:
- deploy_web_eu
uses: ./.github/workflows/reusable-web-deploy.yml
with:
environment: Production
react_app_api_url: https://api.novu.co
react_app_ws_url: https://ws.novu.co
react_app_webhook_url: https://webhook.novu.co
react_app_widget_embed_path: https://embed.novu.co/embed.umd.min.js
react_app_sentry_dsn: https://[email protected]/6250907
react_app_environment: production
react_app_mail_server_domain: inbound-mail.novu.co
react_app_hubspot_embed: 44416662
netlify_deploy_message: Prod deployment
netlify_alias: prod
netlify_gh_env: Production
netlify_site_id: 8639d8b9-81f9-44c3-b885-585a7fd2b5ff
secrets: inherit
Loading

0 comments on commit 1fbaed4

Please sign in to comment.