From ccf79ca8229037c024b0a0fdde6c23548a474fc0 Mon Sep 17 00:00:00 2001 From: anig1scur Date: Wed, 30 Oct 2024 22:24:53 +0800 Subject: [PATCH] feat: deploy to github pages --- .eslintrc.json | 11 ++++++-- .github/workflows/deploy.yml | 53 ++++++++++++++++++++++++++++++++++++ next.config.ts | 7 ++++- src/components/ui/input.tsx | 14 +++++----- 4 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.eslintrc.json b/.eslintrc.json index 3722418..9d34fe2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,10 @@ { - "extends": ["next/core-web-vitals", "next/typescript"] -} + "extends": [ + "next/core-web-vitals", + "next/typescript" + ], + "rules": { + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off" + } +} \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f8c0e5b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,53 @@ +name: Deploy Next.js site to Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: 'pnpm' + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Install dependencies + run: pnpm i + + - name: Build with Next.js + run: pnpm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./out + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/next.config.ts b/next.config.ts index e9ffa30..80e91c9 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,12 @@ -import type { NextConfig } from "next"; +import type {NextConfig} from 'next'; const nextConfig: NextConfig = { /* config options here */ + output: 'export', + basePath: process.env.NODE_ENV === 'production' ? '/fcitx5-theme-designer' : '', + images: { + unoptimized: true, + }, }; export default nextConfig; diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 5af26b2..58e6c79 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -2,20 +2,20 @@ import * as React from "react" import { cn } from "@/lib/utils" -export interface InputProps - extends React.InputHTMLAttributes {} +/* eslint-disable @typescript-eslint/no-empty-object-type */ +export interface InputProps extends React.InputHTMLAttributes { } const Input = React.forwardRef( ({ className, type, ...props }, ref) => { return ( ) }