Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): [CI] add CI action #53

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/api_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build API

on:
- push
- pull_request
- workflow_dispatch

jobs:
install:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

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

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
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: Install dependencies
run: pnpm install

- name: Build
run: pnpm api:build
2 changes: 1 addition & 1 deletion apps/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const app = new Hono({ strict: true })
.use(logger())

// * Mounting versioned APIs
.route('/api/v1', appV1)
.route('/v1', appV1)

export * from './v1/validation'
export * from './prisma/generated/zod'
Expand Down
3 changes: 3 additions & 0 deletions apps/api/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
rewrites: () => [
{ source: '/v1/:path*', destination: '/api/v1/:path*' },
]
}

module.exports = nextConfig
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"license": "GPL-3.0",
"workspaces": ["apps/*", "packages/*"],
"scripts": {
"api:dev": "pnpm --filter @6pm/api run dev",
"api:build": "pnpm --filter @6pm/api run build",
"api:start": "pnpm --filter @6pm/api run start"
},
"devDependencies": {
Expand Down