Skip to content

Commit

Permalink
add workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
pnzrr committed Jul 25, 2024
1 parent 4e0d648 commit d25f056
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/remix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Deploy React Example to Vercel

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_REMIX_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_DEPLOYMENT_TOKEN }}
on:
push:
branches:
- main
paths:
- "frameworks/remix/**"
pull_request:
branches:
- main
paths:
- "frameworks/remix/**"

jobs:
deploy-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./frameworks/remix

- name: Build project
run: npm run build
working-directory: ./frameworks/remix

- name: Install Vercel CLI
run: npm install -g vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix

- name: Build Project Artifacts
run: vercel build --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix

deploy-prod:
if: github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./frameworks/remix

- name: Build project
run: npm run build
working-directory: ./frameworks/remix

- name: Install Vercel CLI
run: npm install -g vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix

- name: Build Project Artifacts
run: vercel build --prod --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN
working-directory: ./frameworks/remix
1 change: 1 addition & 0 deletions frameworks/remix/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
/.cache
/build
.env
.vercel
3 changes: 0 additions & 3 deletions frameworks/remix/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import { LoaderFunctionArgs, json } from "@remix-run/node";
import { Icon } from "@iconify/react";

export async function loader({ request }: LoaderFunctionArgs) {
console.log("🚀 ~ loader ~ request:", authenticator);

const user = await authenticator.isAuthenticated(request);
return json(user);
}

export default function Index() {
const authenticatedUser = useLoaderData<typeof loader>();
console.log("🚀 ~ Index ~ authenticatedUser:", authenticatedUser);
return (
<div className="page-bg min-h-screen">
<picture>
Expand Down

0 comments on commit d25f056

Please sign in to comment.