Deploy PROD WEB #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Deploy PROD 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: | |
# 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 | |
submodule_branch: 'main' | |
secrets: inherit | |
deploy_web_eu: | |
needs: test_web | |
environment: Production | |
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 | |
# Runs a single command using the runners shell | |
- name: Build | |
run: CI='' pnpm build:web | |
- name: Create env file | |
working-directory: apps/web | |
run: | | |
touch .env | |
echo REACT_APP_INTERCOM_APP_ID=${{ secrets.INTERCOM_APP_ID }} >> .env | |
echo REACT_APP_API_URL="https://eu.api.novu.co" >> .env | |
echo REACT_APP_WS_URL="https://eu.ws.novu.co" >> .env | |
echo REACT_APP_WEBHOOK_URL="https://eu.webhook.novu.co" >> .env | |
echo REACT_APP_WIDGET_EMBED_PATH="https://eu.embed.novu.co/embed.umd.min.js" >> .env | |
echo REACT_APP_NOVU_APP_ID=${{ secrets.NOVU_APP_ID }} >> .env | |
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env | |
echo REACT_APP_ENVIRONMENT=production >> .env | |
echo REACT_APP_SEGMENT_KEY=${{ secrets.WEB_SEGMENT_KEY }} >> .env | |
echo REACT_APP_LOGROCKET_ID=${{ secrets.LOGROCKET_ID }} >> .env | |
echo REACT_APP_MAIL_SERVER_DOMAIN="eu.inbound-mail.novu.co" >> .env | |
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env | |
- name: Envsetup | |
working-directory: apps/web | |
run: npm run envsetup | |
- name: Build | |
env: | |
REACT_APP_INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} | |
REACT_APP_SEGMENT_KEY: ${{ secrets.WEB_SEGMENT_KEY }} | |
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_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }} | |
REACT_APP_LOGROCKET_ID: ${{ secrets.LOGROCKET_ID }} | |
REACT_APP_SENTRY_DSN: https://[email protected]/6250907 | |
REACT_APP_ENVIRONMENT: production | |
REACT_APP_MAIL_SERVER_DOMAIN: eu.inbound-mail.novu.co | |
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: ${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} | |
working-directory: apps/web | |
run: npm run build | |
- name: Deploy WEB to PROD | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: apps/web/build | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: Prod deployment | |
production-deploy: true | |
alias: prod | |
github-deployment-environment: Production | |
github-deployment-description: Web Deployment | |
netlify-config-path: apps/web/netlify.toml | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: d2e8b860-7016-4202-9256-ebca0f13259a | |
timeout-minutes: 1 | |
# This workflow contains a single job called "build" | |
deploy_web_us: | |
needs: | |
- test_web | |
- deploy_web_eu | |
environment: Production | |
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 | |
# Runs a single command using the runners shell | |
- name: Build | |
run: CI='' pnpm build:web | |
- name: Create env file | |
working-directory: apps/web | |
run: | | |
touch .env | |
echo REACT_APP_INTERCOM_APP_ID=${{ secrets.INTERCOM_APP_ID }} >> .env | |
echo REACT_APP_API_URL="https://api.novu.co" >> .env | |
echo REACT_APP_WS_URL="https://ws.novu.co" >> .env | |
echo REACT_APP_WEBHOOK_URL="https://webhook.novu.co" >> .env | |
echo REACT_APP_WIDGET_EMBED_PATH="https://embed.novu.co/embed.umd.min.js" >> .env | |
echo REACT_APP_NOVU_APP_ID=${{ secrets.NOVU_APP_ID }} >> .env | |
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env | |
echo REACT_APP_ENVIRONMENT=production >> .env | |
echo REACT_APP_SEGMENT_KEY=${{ secrets.WEB_SEGMENT_KEY }} >> .env | |
echo REACT_APP_LOGROCKET_ID=${{ secrets.LOGROCKET_ID }} >> .env | |
echo REACT_APP_MAIL_SERVER_DOMAIN="inbound-mail.novu.co" >> .env | |
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env | |
- name: Envsetup | |
working-directory: apps/web | |
run: npm run envsetup | |
- name: Build | |
env: | |
REACT_APP_INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} | |
REACT_APP_SEGMENT_KEY: ${{ secrets.WEB_SEGMENT_KEY }} | |
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_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }} | |
REACT_APP_LOGROCKET_ID: ${{ secrets.LOGROCKET_ID }} | |
REACT_APP_SENTRY_DSN: https://[email protected]/6250907 | |
REACT_APP_ENVIRONMENT: production | |
REACT_APP_MAIL_SERVER_DOMAIN: inbound-mail.novu.co | |
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: ${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} | |
working-directory: apps/web | |
run: npm run build | |
- name: Deploy WEB to PROD | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: apps/web/build | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: Prod deployment | |
production-deploy: true | |
alias: prod | |
github-deployment-environment: Production | |
github-deployment-description: Web Deployment | |
netlify-config-path: apps/web/netlify.toml | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: 8639d8b9-81f9-44c3-b885-585a7fd2b5ff | |
timeout-minutes: 1 | |
deploy_docker: | |
needs: | |
- deploy_web_us | |
- deploy_web_eu | |
environment: Production | |
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: Setup Depot | |
uses: depot/setup-action@v1 | |
with: | |
oidc: true | |
- name: Remove build outputs | |
working-directory: apps/web | |
run: rm -rf build | |
# Runs a single command using the runners shell | |
- name: Build | |
run: CI='' pnpm build:web | |
- 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:prod \ | |
-t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest \ | |
-f apps/web/Dockerfile . | |
echo "::set-output name=IMAGE::ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG" |