Merge pull request #4318 from luke-h1/dev #230
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
name: Deploy | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
workflow_dispatch: | |
env: | |
NEXT_PUBLIC_SANITY_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_SANITY_PROJECT_ID }} | |
VERCEL_PROD_PROJECT_ID: ${{ secrets.VERCEL_PROD_PROJECT_ID }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DEV_PROJECT_ID }} | |
BASIC_AUTH_USER: ${{ secrets.BASIC_AUTH_USER }} | |
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }} | |
NODE_VERSION: 20.9.0 | |
PNPM_VERSION: 8.13.1 | |
jobs: | |
deploy-dev: | |
runs-on: ubuntu-latest | |
name: Deploy to dev | |
if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
steps: | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --no-frozen-lockfile | |
- uses: actions/labeler@v4 | |
with: | |
sync-labels: true | |
- name: Check commit message | |
run: pnpm commitlint --from=HEAD^1 | |
- name: format:check | |
run: pnpm format:check | |
- name: lint | |
run: pnpm lint | |
- name: jest | |
run: pnpm test | |
- name: tsc | |
run: pnpm tsc | |
- name: build | |
run: pnpm build | |
- name: local UI tests | |
run: make e2e-install-browsers && make e2e-local-ci | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report-local-${{ github.event_name }}-${{ github.run_id }} | |
path: playwright-report/ | |
- name: Deploy development | |
run: vc -f --prod --token ${VERCEL_TOKEN} | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_DEV_PROJECT_ID: ${{ secrets.VERCEL_DEV_PROJECT_ID }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
- name: Dev UI tests | |
run: make e2e-dev | |
env: | |
BASIC_AUTH_USER: ${{ secrets.BASIC_AUTH_USER }} | |
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }} | |
deploy-live: | |
runs-on: ubuntu-latest | |
name: Deploy to live | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
steps: | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
run_install: false | |
- name: Install dependencies | |
run: pnpm i --no-frozen-lockfile | |
- name: format:check | |
run: pnpm format:check | |
- name: lint | |
run: pnpm lint | |
- name: jest | |
run: pnpm test | |
- name: tsc | |
run: pnpm tsc | |
- name: build | |
run: pnpm build | |
- name: local UI tests | |
run: make e2e-install-browsers && make e2e-local-ci | |
- name: Deploy live | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
run: | | |
vc -f --prod --token ${VERCEL_TOKEN} | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROD_PROJECT_ID }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
- name: Live UI tests | |
run: make e2e-prod |