Revert "get things back up" #1954
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@v2 | |
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 }} |