Skip to content

Merge pull request #231 from nada-deriv/nada/bug-fixes #125

Merge pull request #231 from nada-deriv/nada/bug-fixes

Merge pull request #231 from nada-deriv/nada/bug-fixes #125

name: Build staging and Deploy to Cloudflare Pages
on:
push:
branches:
- 'master'
concurrency:
group: cloudflare-pages-build-staging
cancel-in-progress: true
jobs:
build_to_cloudflare_pages:
timeout-minutes: 30
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout to main branch
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Get cached dependencies
id: cache-npm
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c
with:
path: node_modules
key: npm-${{ hashFiles('./package-lock.json') }}
- name: Install dependencies
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci
shell: bash
- name: Build
run: npm run build
env:
VITE_PROJECT_NAME: ${{ vars.VITE_PROJECT_NAME }}
VITE_CROWDIN_BRANCH_NAME: ${{ vars.VITE_CROWDIN_BRANCH_NAME }}
VITE_TRANSLATIONS_CDN_URL: ${{ vars.VITE_TRANSLATIONS_CDN_URL }}
VITE_TRACKJS_TOKEN: ${{ vars.VITE_TRACKJS_TOKEN }}
VITE_APP_VERSION: ${{ github.ref_name }}
VITE_GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.VITE_GROWTHBOOK_DECRYPTION_KEY }}
VITE_GROWTHBOOK_CLIENT_KEY: ${{ vars.VITE_GROWTHBOOK_CLIENT_KEY }}
VITE_RUDDERSTACK_KEY: ${{ vars.VITE_RUDDERSTACK_KEY }}
VITE_REMOTE_CONFIG_URL: ${{ vars.VITE_REMOTE_CONFIG_URL }}
- name: Run tests for Eslintbuild_to_cloudflare_pages
run: npm run test:lint
- name: Publish to Cloudflare Pages
uses: "deriv-com/shared-actions/.github/actions/publish_to_pages_branch@master"
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
project_name: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
branch_name: staging
output_dir: dist
cname_url: staging-p2p.deriv.com
- name: Upload to vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
with:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
ENVIRONMENT: Preview
VERCEL_SCOPE: deriv
ALIAS_DOMAIN_URL: 'staging-p2p-dr.binary.sx'