Skip to content

Commit

Permalink
Merge branch 'main' into Grade-Dist-Styling-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisl10 authored Dec 10, 2024
2 parents b7063b4 + b966cb5 commit 6d9add2
Show file tree
Hide file tree
Showing 14 changed files with 825 additions and 198 deletions.
27 changes: 27 additions & 0 deletions .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup pnpm
runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
30 changes: 4 additions & 26 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,14 @@

## Screenshots

<!-- Include screenshot for front-end work -->
<!--
|screenshot|
|--|
|image|
-->
<!-- Include before/after screenshot(s) for frontend work -->

<!-- Include BEFORE/AFTER. Delete if N/A. (For visual front-end bug fixes) -->
<!--
|before|after|
|--|--|
|before image|after image|
-->
## Test Plan

## Steps to verify/test this change:

- [ ] Verify changes work as expected on staging instance
<!-- Add more steps here… -->

## Final Checks:

- [ ] Verify successful deployment

(optional)

- [ ] Write tests
- [ ] Write documentation
<!-- Include steps to verify/test this change -->

## Issues

<!-- Link the issue you're closing -->
<!-- Link the issue(s) you're closing -->

Closes #
74 changes: 0 additions & 74 deletions .github/workflows/build-and-deploy.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/clean-up-pr.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy production

on:
push:
branches:
- main

# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
build_and_deploy:
name: Build and deploy
runs-on: ubuntu-latest
environment:
name: production
url: https://peterportal.org
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup pnpm
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
run: pnpm install
env:
HUSKY: 0

- name: Build and deploy
run: pnpm sst deploy --stage prod
env:
DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
NODE_ENV: production

PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }}
GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }}
GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }}
ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }}
PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
50 changes: 50 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy staging

on:
pull_request:
types:
- opened
- reopened
- synchronize

# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment
concurrency:
group: staging-${{ github.event.pull_request.number }}

jobs:
build_and_deploy:
name: Build and deploy
runs-on: ubuntu-latest
# don't run if labeled "no deploy" && don't run on PRs from forks
if: (!contains(github.event.pull_request.labels.*.name, 'no deploy')) && github.event.pull_request.head.repo.full_name == github.repository
environment:
name: staging-${{ github.event.pull_request.number }}
url: https://staging-${{ github.event.pull_request.number }}.peterportal.org
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup pnpm
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
run: pnpm install
env:
HUSKY: 0

- name: Build and deploy
run: pnpm sst deploy --stage staging-${{ github.event.pull_request.number }}
env:
DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}
NODE_ENV: staging

PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }}
GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }}
GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }}
ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }}
PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
28 changes: 3 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,12 @@ jobs:
lint:
name: Lint and check formatting
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
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: Setup pnpm
uses: ./.github/actions/setup-pnpm

- name: Install Dependencies
run: pnpm install
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/remove-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Remove staging

on:
pull_request:
types:
- closed

# use pr number for group instead of github.ref because ref will be main branch when the PR closes which is not a unique group for the PR
# group should match with deploy-staging workflow so those don't run concurrently (if someone closes/reopens a PR)
concurrency:
group: staging-${{ github.event.pull_request.number }}

jobs:
clean-up-pr:
runs-on: ubuntu-latest
# don't run on PRs from forks
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup pnpm
uses: ./.github/actions/setup-pnpm

- name: Install Dependencies
run: pnpm install
env:
HUSKY: 0

- name: Remove staging
run: pnpm sst remove --stage staging-${{ github.event.pull_request.number }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Deactivate deployment
uses: strumwolf/[email protected]
with:
environment: staging-${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
onlyDeactivateDeployments: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ git clone https://github.com/<your username>/peterportal-client

4. Run `pnpm install` to install all node dependencies for the site and API. This may take a few minutes.

5. Rename the `.env.example` file in the api directory to `.env`. This includes the minimum environment variables needed for running the backend.
5. Make a copy of the `.env.example` file in the api directory and name it `.env`. This includes the minimum environment variables needed for running the backend.

6. (Optional) Set up your own PostgreSQL database and Google OAuth to be able to test features that require signing in such as leaving reviews or saving roadmaps to your account. Add additional variables/secrets to the .env file from the previous step.

Expand Down
1 change: 1 addition & 0 deletions api/drizzle/0001_heavy_xavin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "review" ALTER COLUMN "updated_at" DROP DEFAULT;
Loading

0 comments on commit 6d9add2

Please sign in to comment.