Skip to content

Commit

Permalink
Add deploy config
Browse files Browse the repository at this point in the history
  • Loading branch information
zahrabayatt committed Oct 16, 2024
1 parent b9004b3 commit e354761
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 15 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Build project
run: npm run build

- name: Upload production-ready build files
uses: actions/upload-artifact@v3
with:
name: production-files
path: ./dist

deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: production-files
path: ./dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/public/logo.webp" />
<link rel="icon" type="image/svg+xml" href="/logo.webp" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script>
const colorMode = localStorage.getItem("colorMode");
Expand Down
25 changes: 14 additions & 11 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ import ErrorPage from "./pages/ErrorPage";
import TasksPage from "./pages/TasksPage";
import CategoriesPage from "./pages/CategoriesPage";

const router = createBrowserRouter([
{
path: "/",
element: <Layout />,
errorElement: <ErrorPage />,
children: [
{ path: ":categoryId?", element: <TasksPage /> },
{ path: "categories", element: <CategoriesPage /> },
],
},
]);
const router = createBrowserRouter(
[
{
path: "/",
element: <Layout />,
errorElement: <ErrorPage />,
children: [
{ path: ":categoryId?", element: <TasksPage /> },
{ path: "categories", element: <CategoriesPage /> },
],
},
],
{ basename: import.meta.env.BASE_URL }
);

export default router;
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -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({
plugins: [react()],
})
base: "/to-do-app/"
});

0 comments on commit e354761

Please sign in to comment.