Skip to content

Commit

Permalink
chore: add GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosNASA committed Jun 7, 2024
1 parent 6f78e78 commit c3c7d77
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 43 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
4 changes: 1 addition & 3 deletions app/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ export const client = (url: string, options: RequestInit) => {
})
}

export const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
})
export const octokit = new Octokit()
16 changes: 16 additions & 0 deletions app/api/issues.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { octokit } from './client'

export const IssuesAPI = {
get: () =>
octokit.request('GET /repos/{owner}/{repo}/issues', {
owner: 'MarcosNASA',
repo: 'is-sexism-over.tech',
state: 'closed',
labels: 'testimonial',
sort: 'created',
direction: 'desc',
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
}),
}
54 changes: 20 additions & 34 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { type MetaFunction, defer } from '@remix-run/cloudflare'
import { Await, useLoaderData } from '@remix-run/react'
import { Suspense } from 'react'
import { octokit } from '~/api/client'

import { Experience } from '~/features/experience/domain'
import { ExperienceTestimonials } from '../features/experience/components/ExperienceTestimonials'
import { Functional } from '~/lib/Functional'
import { Countdown } from '~/features/countdown/components/Countdown'
import { IssuesAPI } from '~/api/issues'

export const meta: MetaFunction = () => {
return [
Expand All @@ -20,17 +20,7 @@ export const meta: MetaFunction = () => {
}

export const loader = async () => {
const issues = octokit.request('GET /repos/{owner}/{repo}/issues', {
owner: 'MarcosNASA',
repo: 'is-sexism-over.tech',
state: 'closed',
labels: 'testimonial',
sort: 'created',
direction: 'desc',
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
})
const issues = IssuesAPI.get()
return defer({
experiences: issues
.then(Functional.pluck('data'))
Expand All @@ -42,35 +32,31 @@ export default function Index() {
const { experiences } = useLoaderData<typeof loader>()

return (
<div className="scroll-smooth snap-mandatory snap-y h-screen overflow-y-auto flex flex-col gap-8">
<div className="snap-center">
<header className="px-12 py-20 flex flex-col justify-center items-center gap-4">
<h1 className="text-7xl font-bold font-yeseva">
Is sexism over in tech?
</h1>
<p className="text-2xl text-zinc-400">
Share your own and browse others&apos; experiences with sexism in
the tech industry
</p>
</header>
<div className="h-screen overflow-y-auto flex flex-col gap-8">
<header className="px-12 py-20 flex flex-col justify-center items-center gap-4">
<h1 className="text-7xl font-bold font-yeseva">
Is sexism over in tech?
</h1>
<p className="text-2xl text-zinc-400">
Share your own and browse others&apos; experiences with sexism in the
tech industry
</p>
</header>

<main className="px-12 flex-1 h-full">
<Suspense fallback={<Countdown.Skeleton />}>
<Await resolve={experiences}>
{(experiences) => (
<Countdown lastExperience={experiences.at(0)} />
)}
</Await>
</Suspense>
</main>
</div>
<main className="px-12 flex-1 h-full">
<Suspense fallback={<Countdown.Skeleton />}>
<Await resolve={experiences}>
{(experiences) => <Countdown lastExperience={experiences.at(0)} />}
</Await>
</Suspense>
</main>

<Suspense fallback={<ExperienceTestimonials.Skeletons />}>
<Await resolve={experiences}>
{(experiences) => (
<>
{experiences.length > 0 && (
<section className="snap-center w-full min-h-screen pl-2 py-2 md:pl-12 md:py-8">
<section className="w-full min-h-screen pl-2 py-2 md:pl-12 md:py-8">
<ExperienceTestimonials
className="pr-2 md:pr-12"
experiences={experiences}
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
6 changes: 4 additions & 2 deletions worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Generated by Wrangler by running `wrangler types`
// Generated by Wrangler on Fri Jun 07 2024 10:17:19 GMT+0200 (Central European Summer Time)
// by running `wrangler types`

interface Env {}
interface Env {
}
4 changes: 0 additions & 4 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ bucket = "./build/client"

[build]
command = "npm run build"

routes = [
{ pattern = "is-sexism-over.tech", custom_domain = true }
]

0 comments on commit c3c7d77

Please sign in to comment.