remove console.log #1964
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: | |
- main | |
- dev | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
name: π Determine deployable changes | |
runs-on: ubuntu-latest | |
outputs: | |
DEPLOYABLE: ${{steps.changes.outputs.DEPLOYABLE}} | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '50' | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: π Determine deployable changes | |
id: changes | |
run: >- | |
echo ::set-output name=DEPLOYABLE::$(node ./other/is-deployable.js ${{ | |
github.sha }}) | |
- name: β Deployable | |
run: >- | |
echo "DEPLOYABLE: ${{steps.changes.outputs.DEPLOYABLE}}" | |
lint: | |
name: ⬣ ESLint | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v4 | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: π¬ Lint | |
run: npm run lint | |
typecheck: | |
name: Κ¦ TypeScript | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v4 | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: π Type check | |
run: npm run typecheck | |
playwright: | |
name: π Playwright | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
continue-on-error: true | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v3 | |
- name: π Copy test env vars | |
run: cp .env.example .env | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: π¬ Setup ffmpeg | |
uses: FedericoCarboni/setup-ffmpeg@v2 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: π Install Playwright Browsers | |
run: npm run test:e2e:install | |
- name: π Setup Database | |
run: npx prisma migrate reset --force | |
- name: π Build | |
run: npm run build | |
- name: π¦ Prime Site Cache | |
id: site-cache | |
uses: actions/cache@v3 | |
with: | |
path: other/cache.db | |
key: site-cache | |
- name: π Generate Site Cache | |
if: steps.site-cache.outputs.cache-hit != 'true' | |
run: npm run prime-cache:mocks | |
- name: π Playwright tests | |
run: npx playwright test | |
env: | |
PORT: 8811 | |
- name: π Upload report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
deploy: | |
name: π Deploy | |
runs-on: ubuntu-latest | |
needs: [changes, lint, typecheck] | |
# only build/deploy main branch on pushes | |
if: | |
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && | |
github.event_name == 'push' && needs.changes.outputs.DEPLOYABLE == 'true' | |
}} | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '50' | |
- name: π Read app name | |
uses: SebRollen/[email protected] | |
id: app_name | |
with: | |
file: 'fly.toml' | |
field: 'app' | |
- name: π Setup Fly | |
uses: superfly/flyctl-actions/[email protected] | |
- name: π€ update robots | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
run: | |
# replace "Allow" with "Disallow" in public/robots.txt for staging | |
sed -i 's/Allow/Disallow/g' public/robots.txt | |
- name: π Deploy Staging | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
run: | |
flyctl deploy --depot --remote-only --build-arg COMMIT_SHA=${{ | |
github.sha }} --app ${{ steps.app_name.outputs.value }}-staging | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: π Deploy Production | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | |
flyctl deploy --depot --remote-only --build-arg COMMIT_SHA=${{ | |
github.sha }} --build-secret SENTRY_AUTH_TOKEN=${{ | |
secrets.SENTRY_AUTH_TOKEN }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |