-
Notifications
You must be signed in to change notification settings - Fork 3.9k
103 lines (90 loc) · 3.47 KB
/
dev-deploy-widget.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
# This is a basic workflow to help you get started with Actions
name: Deploy DEV Widget
# 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/widget/**'
- 'apps/ws/**'
- 'libs/shared/**'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test_widget:
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
submodules: true
submodule_branch: "next"
secrets: inherit
# This workflow contains a single job called "build"
deploy_widget:
needs: test_widget
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
if: "!contains(github.event.head_commit.message, 'ci skip')"
environment: Development
# 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
# Runs a single command using the runners shell
- name: Build
run: CI='' pnpm build:widget
- name: Create env file
working-directory: apps/widget
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_SENTRY_DSN="https://[email protected]/625116" >> .env
echo REACT_APP_ENVIRONMENT=dev >> .env
- name: Envsetup
working-directory: apps/widget
run: npm run envsetup
- name: Build PROD
working-directory: apps/widget
run: npm run build
- name: Deploy WIDGET to DEV
uses: scopsy/actions-netlify@develop
with:
publish-dir: apps/widget/build
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: dev
production-deploy: true
alias: dev
github-deployment-environment: development
github-deployment-description: Web Deployment
netlify-config-path: apps/widget/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: b9147448-b835-4eb1-a2f0-11102f611f5f
timeout-minutes: 1
- name: Remove build outputs
working-directory: apps/widget
run: rm -rf build
- name: Build, tag, and push image to ghcr.io
id: build-image
env:
REGISTRY_OWNER: novuhq
DOCKER_NAME: novu/widget
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
docker build -t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG -f apps/widget/Dockerfile .
docker tag ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:dev
docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:dev
docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
echo "IMAGE=ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: apps/widget/cypress/screenshots