forked from novuhq/novu
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (80 loc) 路 3.28 KB
/
prod-deploy-inbound-mail.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Deploy PROD Inbound Mail
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
jobs:
test_inbound_mail:
strategy:
matrix:
name: [ 'novu/inbound-mail-ee', 'novu/inbound-mail' ]
uses: ./.github/workflows/reusable-inbound-mail-e2e.yml
with:
ee: ${{ contains (matrix.name,'-ee') }}
secrets: inherit
build_prod_image:
runs-on: ubuntu-latest
timeout-minutes: 80
environment: Production
outputs:
docker_image: ${{ steps.build-image.outputs.IMAGE }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
strategy:
matrix:
name: [ 'novu/inbound-mail-ee', 'novu/inbound-mail' ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- name: build api
run: pnpm build:inbound-mail
- 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 }}
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/inbound-mail && pnpm --silent --workspace-root pnpm-context -- apps/inbound-mail/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/inbound-mail - -t novu-inbound-mail --load --platform=linux/amd64,linux/arm64 --provenance=false
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host --name inbound-mail -dit --env NODE_ENV=test ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
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_inbound_mail_eu:
needs:
- build_prod_image
uses: ./.github/workflows/reusable-app-service-deploy.yml
secrets: inherit
with:
environment: Production
service_name: inbound_mail
terraform_workspace: novu-prod-eu
docker_image: ghcr.io/novuhq/novu/inbound-mail-ee:${{ github.sha }}
deploy_prod_inbound_mail_us:
needs:
- deploy_prod_inbound_mail_eu
- build_prod_image
uses: ./.github/workflows/reusable-app-service-deploy.yml
secrets: inherit
with:
environment: Production
service_name: inbound_mail
terraform_workspace: novu-prod
docker_image: ghcr.io/novuhq/novu/inbound-mail-ee:${{ github.sha }}
deploy_sentry_release: true
sentry_project: inbound-mail