Update dependency upgrades - non-major (#205) #551
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: Lint, Check Types, Build, Deploy to Fly.io | |
on: | |
pull_request_target: | |
push: | |
branches: | |
- main | |
jobs: | |
lint-and-check-types-and-build: | |
name: Lint, Check Types, Build | |
runs-on: ubuntu-latest | |
env: | |
PGHOST: localhost | |
PGDATABASE: security_vulnerability_examples | |
PGUSERNAME: security_vulnerability_examples | |
PGPASSWORD: security_vulnerability_examples | |
steps: | |
- name: Start preinstalled PostgreSQL on Ubuntu | |
run: | | |
sudo systemctl start postgresql.service | |
pg_isready | |
- name: Create database user | |
run: | | |
sudo -u postgres psql --command="CREATE USER security_vulnerability_examples PASSWORD 'security_vulnerability_examples'" --command="\du" | |
- name: Create database and allow user | |
run: | | |
sudo -u postgres createdb --owner=security_vulnerability_examples security_vulnerability_examples | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 'latest' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- run: pnpm migrate up | |
# Also generates next-env.d.ts, required for tsc | |
- name: Build Next.js app | |
run: pnpm build | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
NODE_ENV: production | |
- name: Run TypeScript Compiler | |
run: pnpm tsc | |
- name: Run ESLint | |
run: pnpm eslint . --max-warnings 0 | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
- name: Run Stylelint | |
run: pnpm stylelint '**/*.{css,scss,less,js,tsx}' | |
deploy: | |
name: Deploy to Fly.io | |
runs-on: ubuntu-latest | |
needs: lint-and-check-types-and-build | |
if: github.ref == 'refs/heads/main' | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --remote-only |