ci: add changesets π¦ #36
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 workflow will build PRs submitted to the main branch. | |
name: π· PR Builder | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "LICENSE" | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
jobs: | |
lint: | |
name: ⬣ ESLint (STATIC ANALYSIS) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [lts/*] | |
steps: | |
- name: β¬οΈ Checkout | |
id: checkout | |
uses: actions/[email protected] | |
with: | |
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
fetch-depth: 0 | |
- name: π’ Setup node | |
id: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π₯‘ Setup pnpm | |
id: setup-pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: latest | |
run_install: false | |
- name: π Get pnpm store directory | |
id: get-pnpm-cache-dir | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: π Cache pnpm modules | |
uses: actions/cache@v3 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 𧩠Install Dependencies | |
id: install-dependencies | |
run: pnpm install | |
- name: π¦ Lint All Files | |
id: lint-with-eslint | |
run: pnpm lint | |
typecheck: | |
name: Κ¦ Typecheck (STATIC ANALYSIS) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [lts/*] | |
steps: | |
- name: β¬οΈ Checkout | |
id: checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: π’ Setup node | |
id: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π₯‘ Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: latest | |
run_install: false | |
- name: π Get pnpm store directory | |
id: get-pnpm-cache-dir | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: π Cache pnpm modules | |
uses: actions/cache@v3 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 𧩠Install Dependencies | |
id: install-dependencies | |
run: pnpm install | |
- name: ποΈ Build | |
id: build-the-mono-repo | |
run: pnpm build | |
- name: βοΈ Check Type Errors | |
run: pnpm typecheck | |
test: | |
name: πΎ Unit Test (TESTING) | |
needs: [lint, typecheck] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [lts/*] | |
steps: | |
- name: β¬οΈ Checkout | |
id: checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: π’ Setup node | |
id: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π₯‘ Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: latest | |
run_install: false | |
- name: π Get pnpm store directory | |
id: get-pnpm-cache-dir | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: π Cache pnpm modules | |
uses: actions/cache@v3 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 𧩠Install Dependencies | |
id: install-dependencies | |
run: pnpm install | |
- name: π Run Jest & Collect Coverage | |
id: run-jest-test-and-coverage | |
run: pnpm test | |
build: | |
name: π§ Build | |
needs: [lint, typecheck, test] | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [lts/*] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: β¬οΈ Checkout | |
id: checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: π’ Setup node | |
id: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π₯‘ Setup pnpm | |
id: setup-pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: latest | |
run_install: false | |
- name: π Get pnpm store directory | |
id: get-pnpm-cache-dir | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: π Cache pnpm modules | |
uses: actions/cache@v3 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 𧩠Install Dependencies | |
id: install-dependencies | |
run: pnpm install | |
- name: ποΈ Build | |
id: build-the-mono-repo | |
run: | | |
cd app | |
# Set ENV | |
touch .env.local | |
echo "NEXT_PUBLIC_ENVIRONMENT='PROD'" >> .env.local | |
echo "MAINTENANCE_MODE='false'" >> .env.local | |
echo "NEXT_PUBLIC_GTM_CONTAINER_ID='${{secrets.GTM_CONTAINER_ID}}'" >> .env.local | |
echo "SITE_URL='https://brionmario.com'" >> .env.local | |
cd .. | |
pnpm build | |
# SEO work | |
cd app | |
pnpm generate:site-map |