diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a32cc7f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: Build and Deploy +env: + VITE_RAWG_API_KEY: ${{ secrets.RAWG_API_KEY }} +on: + workflow_dispatch: + push: + branches: + - main + schedule: + - cron: "0 12 * * 1" # see https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events +permissions: + contents: write +jobs: + build-and-deploy: + concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: Install Bun 🔧 + uses: oven-sh/setup-bun@v1 + + - name: Install and Build 🔧 # This example project is built using bun and outputs the result to the 'dist' folder + run: | + bun install + bun run build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: dist # The folder the action should deploy. + branch: gh-pages # The branch the action should deploy to. diff --git a/bun.lockb b/bun.lockb index 3bf4541..3560e34 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 8d3e041..f95ec98 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://kavetirohith.github.io/GameHub", "name": "gamehub", "private": true, "version": "0.0.0", @@ -7,7 +8,9 @@ "dev": "vite", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" + "preview": "vite preview", + "predeploy": "tsc && vite build", + "deploy": "gh-pages -d dist" }, "dependencies": { "@chakra-ui/react": "^2.8.1", @@ -15,6 +18,7 @@ "@emotion/styled": "^11.11.0", "axios": "^1.5.0", "framer-motion": "^10.16.4", + "gh-pages": "^6.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0" diff --git a/vite.config.ts b/vite.config.ts index 5a33944..aa5f34a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,8 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ + base: "/GameHub", plugins: [react()], -}) +});