From e5e9bfa14a07fe260ff0b23b6290994b07f08bb9 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Sat, 6 Sep 2025 22:49:57 +0200 Subject: [PATCH] Add deployment --- .github/workflows/deploy.yml | 45 ++++++++++++++++++++++++++++++++++++ src/App.vue | 1 + src/pages/HomeView.vue | 5 ++++ src/pages/StatsView.vue | 7 ++++++ src/router/index.ts | 20 +++++++++++++--- vite.config.ts | 1 + 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 src/pages/HomeView.vue create mode 100644 src/pages/StatsView.vue diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ab0bf65 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Deploy static content to Pages + +on: + push: + branches: ['main', 'master'] + + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + env: + BASE: /tramtrack/ + VITE_ROUTER: hash + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + - run: bun install --include=dev + - name: Check project + run: bun run check:all + - name: Build project + run: bun run build-only + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/src/App.vue b/src/App.vue index abfd315..74929bc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,6 +6,7 @@ Visit vuejs.org to read the documentation

+ diff --git a/src/pages/HomeView.vue b/src/pages/HomeView.vue new file mode 100644 index 0000000..84dc043 --- /dev/null +++ b/src/pages/HomeView.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/src/pages/StatsView.vue b/src/pages/StatsView.vue new file mode 100644 index 0000000..06c9c88 --- /dev/null +++ b/src/pages/StatsView.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 68cda64..ef8592e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,8 +1,22 @@ -import { createRouter, createWebHistory } from 'vue-router'; +import HomeView from '@/pages/HomeView.vue'; +import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'; const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), - routes: [] + history: + import.meta.env.VITE_ROUTER === 'hash' + ? createWebHashHistory(import.meta.env.BASE_URL) + : createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: HomeView + }, + { + path: '/stats', + component: () => import('../pages/StatsView.vue') + } + ] }); export default router; diff --git a/vite.config.ts b/vite.config.ts index e313208..a625478 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,7 @@ import vueDevTools from 'vite-plugin-vue-devtools'; // https://vite.dev/config/ export default defineConfig({ + base: process.env.BASE || '/', plugins: [vue(), vueDevTools()], resolve: { alias: {