diff --git a/.env.example b/.env.example index 0cc84545..905c6284 100644 --- a/.env.example +++ b/.env.example @@ -25,4 +25,4 @@ AB_FEATURE_TESTING_PORTALS= SENTRY_ORG= SENTRY_PROJECT= NEXT_PUBLIC_SENTRY_DSN= -SENTRY_AUTHTOKEN= +SENTRY_AUTH_TOKEN= diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..7aa4bdc8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,112 @@ +name: Deploy + +on: + push: + branches: [master] + +# Newer push to master supersedes an in-flight deploy run. +concurrency: + group: deploy-production + cancel-in-progress: true + +permissions: + contents: read + +# Actions are pinned to full commit SHAs, not @v4 tags: tags are mutable, +# and the deploy job runs these before handing production secrets to the +# deploy step. A moved tag must not run here. Bump SHA + version comment together. +jobs: + typecheck: + name: Typecheck tests + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.14.0 + cache: yarn + cache-dependency-path: './yarn.lock' + + - name: Install dependencies + run: yarn install --immutable + + - name: Typecheck test files + run: yarn typecheck:test + + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.14.0 + cache: yarn + cache-dependency-path: './yarn.lock' + + - name: Install dependencies + run: yarn install --immutable + + - name: Run tests + run: yarn test + + lint: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.14.0 + cache: yarn + cache-dependency-path: './yarn.lock' + + - name: Install dependencies + run: yarn install --immutable + + - name: Run linters + run: yarn lint:check && yarn prettier:check + + deploy: + name: Deploy to Trigger.dev + needs: [typecheck, test, lint] + runs-on: ubuntu-latest + environment: Production + timeout-minutes: 20 + + steps: + - name: Check out Git repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.14.0 + cache: yarn + cache-dependency-path: './yarn.lock' + + - name: Install dependencies + run: yarn install --immutable + + - name: Deploy to Trigger.dev production + run: yarn trigger:deploy + env: + TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} + TRIGGER_PROJECT_ID: ${{ secrets.TRIGGER_PROJECT_ID }} + VERCEL_ENV: production + 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 }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d3abcb00..53df4bbc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,6 +2,8 @@ name: Lint on: push +# Actions pinned to full commit SHAs: tags are mutable and can be moved +# after a compromise. Bump SHA + version comment together. jobs: run-linters: name: Run linters @@ -9,10 +11,10 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: 22.14.0 cache: yarn diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ccdba289..6c950208 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,8 @@ name: CI on: pull_request +# Actions pinned to full commit SHAs: tags are mutable and can be moved +# after a compromise. Bump SHA + version comment together. jobs: typecheck: name: Typecheck tests @@ -9,10 +11,10 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: 22.14.0 cache: yarn @@ -30,10 +32,10 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: 22.14.0 cache: yarn