forked from novuhq/novu
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (115 loc) · 4.63 KB
/
dev-deploy-web.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# This is a basic workflow to help you get started with Actions
name: Deploy DEV WEB
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
branches:
- next
- main
paths:
- 'apps/web/**'
- 'libs/shared/**'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test_web:
uses: ./.github/workflows/reusable-web-e2e.yml
with:
submodules: true
secrets: inherit
# This workflow contains a single job called "build"
deploy_web:
needs: test_web
environment: Development
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
permissions:
contents: read
packages: write
deployments: write
id-token: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- name: Build
run: CI='' pnpm build:web
- name: Create env file
working-directory: apps/web
run: |
touch .env
echo REACT_APP_API_URL="https://dev.api.novu.co" >> .env
echo REACT_APP_WS_URL="https://dev.ws.novu.co" >> .env
echo REACT_APP_WEBHOOK_URL="https://dev.webhook.novu.co" >> .env
echo REACT_APP_WIDGET_EMBED_PATH="https://dev.embed.novu.co/embed.umd.min.js" >> .env
echo REACT_APP_NOVU_APP_ID=${{ secrets.NOVU_APP_ID }} >> .env
echo REACT_APP_SEGMENT_KEY=${{ secrets.WEB_SEGMENT_KEY }} >> .env
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env
echo REACT_APP_ENVIRONMENT=dev >> .env
echo REACT_APP_MAIL_SERVER_DOMAIN="dev.inbound-mail.novu.co" >> .env
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.DEV_LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env
- name: Envsetup
working-directory: apps/web
run: npm run envsetup
# Runs a single command using the runners shell
- name: Build
env:
REACT_APP_SEGMENT_KEY: ${{ secrets.WEB_SEGMENT_KEY }}
REACT_APP_INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }}
REACT_APP_API_URL: https://dev.api.novu.co
REACT_APP_WS_URL: https://dev.ws.novu.co
REACT_APP_WEBHOOK_URL: https://dev.webhook.novu.co
REACT_APP_WIDGET_EMBED_PATH: https://dev.embed.novu.co/embed.umd.min.js
REACT_APP_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }}
REACT_APP_SENTRY_DSN: https://[email protected]/6250907
REACT_APP_ENVIRONMENT: dev
REACT_APP_MAIL_SERVER_DOMAIN: dev.inbound-mail.novu.co
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: ${{ secrets.DEV_LAUNCH_DARKLY_CLIENT_SIDE_ID }}
working-directory: apps/web
run: npm run build
- name: Deploy WEB to DEV
uses: nwtgck/[email protected]
with:
publish-dir: apps/web/build
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: Dev deployment
production-deploy: true
alias: dev
github-deployment-environment: development
github-deployment-description: Web Deployment
netlify-config-path: apps/web/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: 45396446-dc86-4ad6-81e4-86d3eb78d06f
timeout-minutes: 1
- name: Setup Depot
uses: depot/setup-action@v1
with:
oidc: true
- name: Remove build outputs
working-directory: apps/web
run: rm -rf build
- name: Build, tag, and push image to ghcr.io
id: build-image
env:
REGISTRY_OWNER: novuhq
DOCKER_NAME: novu/web
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DEPOT_PROJECT_ID: f88777ff6m
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
depot build --push \
-t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG \
-t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:dev \
-f apps/web/Dockerfile .
echo "::set-output name=IMAGE::ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG"
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: apps/web/cypress/screenshots