Skip to content

Commit

Permalink
feat: 691 sso authentication (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
zekhoi authored Aug 25, 2024
1 parent 6d7baff commit 9b9c587
Show file tree
Hide file tree
Showing 34 changed files with 3,502 additions and 3,407 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# .env
NODE_ENV="development"
NEXT_PUBLIC_URL="http://localhost:3000"
PORT="3000"
DATABASE_URL="postgresql://sainseni:sainseni@localhost:5432/sainseni_db"
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
GITHUB_CLIENT_SECRET=""
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
7 changes: 3 additions & 4 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ env:
on:
push:
paths:
- '.github/workflows/database.yml'
- 'drizzle/**'
- 'src/database/**'
pull_request:
paths:
- '.github/workflows/database.yml'
- 'drizzle/**'
- 'src/database/**'
jobs:
Expand Down Expand Up @@ -53,10 +55,7 @@ jobs:
echo "Database Seeded"
migrate_staging:
if: github.event_name == 'push'
unless: startsWith(github.ref, 'refs/tags/')
branches:
- main
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags/') && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Skip
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: PR
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
GITHUB_CLIENT_ID: ${{ secrets.OAUTH_GITHUB_CLIENT_ID_STAGING }}
GITHUB_CLIENT_SECRET: ${{ secrets.OAUTH_GITHUB_CLIENT_SECRET_STAGING }}
GOOGLE_CLIENT_ID: ${{ secrets.OAUTH_GOOGLE_CLIENT_ID_STAGING }}
GOOGLE_CLIENT_SECRET: ${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET_STAGING }}
on:
pull_request:
branches:
Expand Down Expand Up @@ -37,6 +41,14 @@ jobs:
- name: Install Vercel CLI with pnpm
run: pnpm add -g vercel@latest

- name: Set env Vercel
run: |
echo "${{ secrets.DATABASE_URL_STAGING }}" | vercel env add DATABASE_URL preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_ID_STAGING }}" | vercel env add GITHUB_CLIENT_ID preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_SECRET_STAGING }}" | vercel env add GITHUB_CLIENT_SECRET preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_ID_STAGING }}" | vercel env add GOOGLE_CLIENT_ID preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET_STAGING }}" | vercel env add GOOGLE_CLIENT_SECRET preview --token=${{ secrets.VERCEL_TOKEN }} || true
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
GITHUB_CLIENT_ID: ${{ secrets.OAUTH_GITHUB_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.OAUTH_GITHUB_CLIENT_SECRET }}
GOOGLE_CLIENT_ID: ${{ secrets.OAUTH_GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET }}
on:
push:
tags:
Expand Down Expand Up @@ -39,6 +43,14 @@ jobs:
- name: Install Vercel CLI with pnpm
run: pnpm add -g vercel@latest

- name: Set env Vercel
run: |
echo "${{ secrets.DATABASE_URL }}" | vercel env add DATABASE_URL production --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_ID }}" | vercel env add GITHUB_CLIENT_ID production --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_SECRET }}" | vercel env add GITHUB_CLIENT_SECRET production --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_ID }}" | vercel env add GOOGLE_CLIENT_ID production --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET }}" | vercel env add GOOGLE_CLIENT_SECRET production --token=${{ secrets.VERCEL_TOKEN }} || true
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Staging
env:
DATABASE_URL: ${{ secrets.DATABASE_URL_STAGING }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
GITHUB_CLIENT_ID: ${{ secrets.OAUTH_GITHUB_CLIENT_ID_STAGING }}
GITHUB_CLIENT_SECRET: ${{ secrets.OAUTH_GITHUB_CLIENT_SECRET_STAGING }}
GOOGLE_CLIENT_ID: ${{ secrets.OAUTH_GOOGLE_CLIENT_ID_STAGING }}
GOOGLE_CLIENT_SECRET: ${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET_STAGING }}
on:
push:
branches:
Expand All @@ -22,6 +27,14 @@ jobs:
- name: Install Vercel CLI with pnpm
run: pnpm add -g vercel@latest

- name: Set env Vercel
run: |
echo "${{ secrets.DATABASE_URL_STAGING }}" | vercel env add DATABASE_URL preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_ID_STAGING }}" | vercel env add GITHUB_CLIENT_ID preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GITHUB_CLIENT_SECRET_STAGING }}" | vercel env add GITHUB_CLIENT_SECRET preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_ID_STAGING }}" | vercel env add GOOGLE_CLIENT_ID preview --token=${{ secrets.VERCEL_TOKEN }} || true
echo "${{ secrets.OAUTH_GOOGLE_CLIENT_SECRET_STAGING }}" | vercel env add GOOGLE_CLIENT_SECRET preview --token=${{ secrets.VERCEL_TOKEN }} || true
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# environment variables
.env.*
.env
.env*
!.env.example

# dependencies
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-slot": "^1.1.0",
"arctic": "^1.9.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
Expand Down
Loading

0 comments on commit 9b9c587

Please sign in to comment.