From e0dc7123dd343a49aa389573c13660d49e5c7adf Mon Sep 17 00:00:00 2001 From: techfg Date: Sat, 6 Apr 2024 04:04:10 -0700 Subject: [PATCH] chore: use dynamic site url & base path --- .github/workflows/gh-pages-deploy.yml | 3 +++ site/astro.config.mjs | 4 ++-- site/src/env.d.ts | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages-deploy.yml b/.github/workflows/gh-pages-deploy.yml index a45461d..7e67653 100644 --- a/.github/workflows/gh-pages-deploy.yml +++ b/.github/workflows/gh-pages-deploy.yml @@ -27,6 +27,9 @@ jobs: - name: Checkout your repository using git uses: actions/checkout@v4 - name: Install, build, and upload your site output + env: + SITE_URL: https://${{ github.repository.owner }}.github.io + BASE_PATH: ${{ github.event.repository.name }} uses: withastro/action@v2 with: path: site diff --git a/site/astro.config.mjs b/site/astro.config.mjs index 5e59a15..b114102 100644 --- a/site/astro.config.mjs +++ b/site/astro.config.mjs @@ -3,8 +3,8 @@ import starlight from '@astrojs/starlight'; // https://astro.build/config export default defineConfig({ - site: 'https://techfg.github.io', - base: 'ImageMapster', + site: import.meta.env.SITE_URL || 'https://jamietre.github.io', + base: import.meta.env.BASE_PATH || 'ImageMapster', integrations: [ starlight({ title: 'My Docs', diff --git a/site/src/env.d.ts b/site/src/env.d.ts index acef35f..11a344e 100644 --- a/site/src/env.d.ts +++ b/site/src/env.d.ts @@ -1,2 +1,11 @@ /// /// + +interface ImportMetaEnv { + readonly SITE_URL: string; + readonly BASE_PATH: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +}