barreloflube commited on
Commit
1170ca2
·
1 Parent(s): 351bea0

refactor: simplify deployment and remove GitHub Pages configuration

Browse files
.github/workflows/deploy-github-pages.yml DELETED
@@ -1,54 +0,0 @@
1
- name: Deploy to GitHub Pages
2
-
3
- on:
4
- push:
5
- branches:
6
- - main # Set to your default branch
7
- workflow_dispatch: # Allow manual triggering of the workflow
8
-
9
- permissions:
10
- contents: read
11
- pages: write
12
- id-token: write
13
-
14
- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15
- concurrency:
16
- group: "pages"
17
- cancel-in-progress: false
18
-
19
- jobs:
20
- build:
21
- runs-on: ubuntu-latest
22
- steps:
23
- - name: Checkout code
24
- uses: actions/checkout@v4
25
-
26
- - name: Setup Bun
27
- uses: oven-sh/setup-bun@v1
28
- with:
29
- bun-version: latest
30
-
31
- - name: Install dependencies
32
- run: bun install
33
-
34
- - name: Build project for GitHub Pages
35
- run: bun run build:github
36
-
37
- - name: Setup Pages
38
- uses: actions/configure-pages@v4
39
-
40
- - name: Upload artifact
41
- uses: actions/upload-pages-artifact@v3
42
- with:
43
- path: './dist'
44
-
45
- deploy:
46
- environment:
47
- name: github-pages
48
- url: ${{ steps.deployment.outputs.page_url }}
49
- runs-on: ubuntu-latest
50
- needs: build
51
- steps:
52
- - name: Deploy to GitHub Pages
53
- id: deployment
54
- uses: actions/deploy-pages@v4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/push-to-huggingface.yml CHANGED
@@ -1,49 +1,25 @@
1
  name: Push to Hugging Face Space
2
 
3
  on:
4
- # Trigger after GitHub Pages deployment succeeds
5
- workflow_run:
6
- workflows: ["Deploy to GitHub Pages"]
7
- types:
8
- - completed
9
  branches:
10
- - main
11
  workflow_dispatch: # Allow manual triggering of the workflow
12
 
13
  jobs:
14
  push-to-huggingface:
15
  runs-on: ubuntu-latest
16
- if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
17
  steps:
18
  - name: Checkout code
19
- uses: actions/checkout@v4
20
-
21
- - name: Setup Bun
22
- uses: oven-sh/setup-bun@v1
23
  with:
24
- bun-version: latest
25
-
26
- - name: Install dependencies
27
- run: bun install
28
-
29
- - name: Build project
30
- run: bun run build
31
 
32
- - name: Configure Git for Hugging Face
33
  run: |
34
  git config --global user.email "github-actions[bot]@users.noreply.github.com"
35
  git config --global user.name "GitHub Actions"
36
 
37
- - name: Create temporary branch for HF deployment
38
- run: |
39
- # Create and switch to a new branch with just the dist contents
40
- git checkout --orphan temp-branch
41
- git rm -rf .
42
- cp -r dist/* .
43
- touch .nojekyll
44
- git add .
45
- git commit -m "Deploy to Hugging Face Space"
46
-
47
  - name: Push to Hugging Face Space
48
  env:
49
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
@@ -54,5 +30,5 @@ jobs:
54
  # Set URL with token for authentication
55
  git remote add space https://api-key:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}
56
 
57
- # Push to the main branch of the Space
58
- git push --force space temp-branch:main
 
1
  name: Push to Hugging Face Space
2
 
3
  on:
4
+ push:
 
 
 
 
5
  branches:
6
+ - gh-pages # Set to your default branch if different
7
  workflow_dispatch: # Allow manual triggering of the workflow
8
 
9
  jobs:
10
  push-to-huggingface:
11
  runs-on: ubuntu-latest
 
12
  steps:
13
  - name: Checkout code
14
+ uses: actions/checkout@v3
 
 
 
15
  with:
16
+ fetch-depth: 0
 
 
 
 
 
 
17
 
18
+ - name: Configure Git
19
  run: |
20
  git config --global user.email "github-actions[bot]@users.noreply.github.com"
21
  git config --global user.name "GitHub Actions"
22
 
 
 
 
 
 
 
 
 
 
 
23
  - name: Push to Hugging Face Space
24
  env:
25
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
 
30
  # Set URL with token for authentication
31
  git remote add space https://api-key:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}
32
 
33
+ # Push to the gh-pages branch of the Space
34
+ git push --force space gh-pages:gh-pages
package.json CHANGED
@@ -2,24 +2,15 @@
2
  "name": "react-vite-ui",
3
  "private": true,
4
  "homepage": "https://sheer-8kp.pages.dev/",
5
- "deployments": [
6
- "https://sheer-8kp.pages.dev/",
7
- "https://mantrakp04.github.io/sheer",
8
- "https://huggingface.co/spaces/mantrakp/sheer"
9
- ],
10
  "version": "0.0.1",
11
  "type": "module",
12
  "scripts": {
13
  "dev": "vite",
14
  "build": "tsc -b && vite build",
15
- "build:github": "tsc -b && vite build --mode github",
16
  "lint": "eslint .",
17
  "preview": "vite preview",
18
  "predeploy": "bun run build",
19
- "deploy:cloudflare": "bun run build && npx wrangler pages deploy dist",
20
- "deploy:trigger-github": "gh workflow run deploy-github-pages.yml",
21
- "deploy:trigger-huggingface": "gh workflow run push-to-huggingface.yml",
22
- "deploy:all": "bun run deploy:cloudflare && bun run deploy:trigger-github && bun run deploy:trigger-huggingface"
23
  },
24
  "dependencies": {
25
  "@clerk/clerk-react": "^5.23.0",
 
2
  "name": "react-vite-ui",
3
  "private": true,
4
  "homepage": "https://sheer-8kp.pages.dev/",
 
 
 
 
 
5
  "version": "0.0.1",
6
  "type": "module",
7
  "scripts": {
8
  "dev": "vite",
9
  "build": "tsc -b && vite build",
 
10
  "lint": "eslint .",
11
  "preview": "vite preview",
12
  "predeploy": "bun run build",
13
+ "deploy": "bun run build && npx wrangler pages deploy dist"
 
 
 
14
  },
15
  "dependencies": {
16
  "@clerk/clerk-react": "^5.23.0",
src/App.tsx CHANGED
@@ -9,15 +9,11 @@ import { HuggingFaceCallback } from "./pages/integrations/huggingface-callback";
9
 
10
  function App() {
11
  const queryClient = new QueryClient();
12
-
13
- // Get the base URL from Vite's import.meta.env
14
- // This will be set based on the `base` option in vite.config.ts
15
- const basename = import.meta.env.BASE_URL;
16
 
17
  return (
18
  <QueryClientProvider client={queryClient}>
19
  <LoadingProvider>
20
- <BrowserRouter basename={basename}>
21
  <Routes>
22
  {routes.map((route) => (
23
  <Route
 
9
 
10
  function App() {
11
  const queryClient = new QueryClient();
 
 
 
 
12
 
13
  return (
14
  <QueryClientProvider client={queryClient}>
15
  <LoadingProvider>
16
+ <BrowserRouter>
17
  <Routes>
18
  {routes.map((route) => (
19
  <Route
vite.config.ts CHANGED
@@ -3,31 +3,23 @@ import react from "@vitejs/plugin-react";
3
  import { resolve } from "path";
4
 
5
  // https://vitejs.dev/config/
6
- export default defineConfig(({ mode }) => {
7
- // Default base is '/' which works for most cases
8
- // When deploying to GitHub Pages, we need to use the repo name as the base
9
- // For Cloudflare Pages and HuggingFace, '/' works fine
10
- const base = mode === 'github' ? '/sheer/' : '/';
11
-
12
- return {
13
- base,
14
- build: {
15
- target: "esnext",
16
- },
17
- plugins: [react()],
18
- resolve: {
19
- alias: {
20
- "@": resolve(__dirname, "./src"),
21
- },
22
  },
23
- server: {
24
- proxy: {
25
- 'http://localhost:11434': {
26
- target: 'http://localhost:11434',
27
- changeOrigin: true,
28
- secure: false,
29
- }
30
  }
31
  }
32
- };
33
  });
 
3
  import { resolve } from "path";
4
 
5
  // https://vitejs.dev/config/
6
+ export default defineConfig({
7
+ build: {
8
+ target: "esnext",
9
+ },
10
+ plugins: [react()],
11
+ resolve: {
12
+ alias: {
13
+ "@": resolve(__dirname, "./src"),
 
 
 
 
 
 
 
 
14
  },
15
+ },
16
+ server: {
17
+ proxy: {
18
+ 'http://localhost:11434': {
19
+ target: 'http://localhost:11434',
20
+ changeOrigin: true,
21
+ secure: false,
22
  }
23
  }
24
+ }
25
  });