diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000..7574299 --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,50 @@ +name: Deploy Astro Site to GitHub Pages + +on: + push: + branches: [main] + paths: + - 'site/**' + - '.github/workflows/deploy-site.yml' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: site + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: site/package-lock.json + + - run: npm ci + - run: npm run build + + - uses: actions/upload-pages-artifact@v3 + with: + path: site/dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/site/astro.config.mjs b/site/astro.config.mjs index 8c84f09..4730def 100644 --- a/site/astro.config.mjs +++ b/site/astro.config.mjs @@ -1,7 +1,10 @@ import { defineConfig } from 'astro/config' import tailwindcss from '@tailwindcss/vite' +const isGitHubPages = process.env.GITHUB_ACTIONS === 'true' + export default defineConfig({ output: 'static', + base: isGitHubPages ? '/clustri/' : '/', vite: { plugins: [tailwindcss()] }, }) diff --git a/site/src/components/ScreenshotTour.astro b/site/src/components/ScreenshotTour.astro index d475e6d..5d5f524 100644 --- a/site/src/components/ScreenshotTour.astro +++ b/site/src/components/ScreenshotTour.astro @@ -1,5 +1,6 @@ --- import DotMatrixText from './DotMatrixText.astro' +const base = import.meta.env.BASE_URL ---
@@ -33,8 +34,8 @@ import DotMatrixText from './DotMatrixText.astro'

Virtual Machines — 4 VMs across the cluster

-
- Clustri VM list showing running and stopped VMs +
+ Clustri VM list showing running and stopped VMs
@@ -59,10 +60,11 @@ import DotMatrixText from './DotMatrixText.astro' const img = document.getElementById('tour-img') as HTMLImageElement | null const label = document.getElementById('tour-frame-label') const tabs = document.querySelectorAll('[data-tour-tab]') + const baseUrl = img?.closest('[data-base-url]')?.getAttribute('data-base-url') || '/' const sources: Record = { - vms: { src: '/screenshots/vms.png', label: 'Virtual Machines — 4 VMs across the cluster', alt: 'Clustri VM list showing running and stopped VMs' }, - console: { src: '/screenshots/console.png', label: 'VNC Console — web-01 (QEMU) on pve1', alt: 'Clustri console view with VNC viewer' }, - backups: { src: '/screenshots/backups.png', label: 'Backups — datastores, groups and snapshots', alt: 'Clustri backups view with datastores and prune controls' }, + vms: { src: `${baseUrl}screenshots/vms.png`, label: 'Virtual Machines — 4 VMs across the cluster', alt: 'Clustri VM list showing running and stopped VMs' }, + console: { src: `${baseUrl}screenshots/console.png`, label: 'VNC Console — web-01 (QEMU) on pve1', alt: 'Clustri console view with VNC viewer' }, + backups: { src: `${baseUrl}screenshots/backups.png`, label: 'Backups — datastores, groups and snapshots', alt: 'Clustri backups view with datastores and prune controls' }, } tabs.forEach((btn) => { btn.addEventListener('click', () => { diff --git a/site/src/layouts/Base.astro b/site/src/layouts/Base.astro index 879c894..3a29cf4 100644 --- a/site/src/layouts/Base.astro +++ b/site/src/layouts/Base.astro @@ -11,7 +11,7 @@ const { title = 'Clustri', description = 'A desktop client for managing Proxmox - + {title}