Skip to content

Merge pull request #4142 from novuhq/feat-ws-performance-improvements #477

Merge pull request #4142 from novuhq/feat-ws-performance-improvements

Merge pull request #4142 from novuhq/feat-ws-performance-improvements #477

# 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 "::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/widget/cypress/screenshots