Skip to content

Dev

Dev #422

Workflow file for this run

name: Monorepo
on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
yarn-monorepo:
name: Build Yarn Turborepo
timeout-minutes: 60
runs-on: buildjet-4vcpu-ubuntu-2204
# configures turborepo Remote Caching
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
npm-changed:
- 'sdk/client/**'
- 'sdk/firstload/**'
- 'sdk/highlight-apollo/**'
- 'sdk/highlight-cloudflare/**'
- 'sdk/highlight-nest/**'
- 'sdk/highlight-next/**'
- 'sdk/highlight-node/**'
- 'sdk/highlight-react/**'
- 'sdk/highlight-remix/**'
- 'sdk/opentelemetry-sdk-workers/packages/opentelemetry-sdk-workers/**'
# automatically caches dependencies based on yarn.lock
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
- name: Install js dependencies
run: yarn
- name: Check check for duplicate deps
run: yarn dedupe --check
- name: Check generated files for Reflame
run: yarn reflame-check
- name: Check formatting
run: yarn format-check
- name: Configure AWS credentials
if: github.event.pull_request.head.repo.full_name == 'highlight/highlight' || github.ref == 'refs/heads/main'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Build & test (in a fork without doppler)
run: yarn test:all
env:
GRAPHCMS_TOKEN: ${{ secrets.GRAPHCMS_TOKEN }}
NEXT_PUBLIC_HIGHLIGHT_PROJECT_ID: 1jdkoe52
REACT_APP_COMMIT_SHA: ${{ github.sha }}
- name: Build render
# does not work for open source builds as doppler is required
if: github.event.pull_request.head.repo.full_name == 'highlight/highlight' || github.ref == 'refs/heads/main'
run: doppler run -- yarn build:render
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_RENDER_SECRET }}
- name: Upload frontend sourcemaps
if: github.ref == 'refs/heads/main'
run: yarn sourcemaps:frontend
env:
HIGHLIGHT_API_KEY: ${{ secrets.HIGHLIGHT_SOURCEMAP_API_KEY }}
APP_VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Configure yarn npm registry credentials
if: github.event.pull_request.head.repo.full_name == 'highlight/highlight' || github.ref == 'refs/heads/main'
run: |
yarn config set npmRegistryServer "https://registry.npmjs.org"
yarn config set npmAuthToken "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish npm packages
if: github.ref == 'refs/heads/main'
id: changesets-publish
uses: changesets/action@v1
with:
publish: yarn publish:turbo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish ai lambda
if: github.ref == 'refs/heads/main'
run: yarn publish:ai
- name: Publish session-insights-email lambda
if: github.ref == 'refs/heads/main'
run: yarn publish:react-email-templates
- name: Publish render lambda
if: github.ref == 'refs/heads/main'
run: yarn publish:render
- name: Release changesets
if: github.ref == 'refs/heads/main'
id: changesets-version
uses: changesets/action@v1
with:
version: yarn changeset version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}