diff --git a/.github/workflows/squad-docs.yml b/.github/workflows/squad-docs.yml index ffa43eb3a..fcd375f24 100644 --- a/.github/workflows/squad-docs.yml +++ b/.github/workflows/squad-docs.yml @@ -36,6 +36,9 @@ jobs: - name: Build docs site working-directory: docs run: npm run build + env: + SQUAD_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }} + GITHUB_SHA: ${{ github.sha }} - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 7f7d76baf..5c4de456e 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -3,6 +3,9 @@ import tailwindcss from '@tailwindcss/vite'; import sitemap from '@astrojs/sitemap'; import { remarkRewriteLinks } from './src/plugins/remark-rewrite-links.mjs'; import { rehypePagefindAttrs } from './src/plugins/rehype-pagefind-attrs.mjs'; +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); export default defineConfig({ site: 'https://bradygaster.github.io', @@ -10,6 +13,11 @@ export default defineConfig({ integrations: [sitemap()], vite: { plugins: [tailwindcss()], + define: { + __VERSION__: JSON.stringify(process.env.SQUAD_VERSION || require('../package.json').version), + __COMMIT_SHA__: JSON.stringify(process.env.GITHUB_SHA || 'local'), + __BUILD_DATE__: JSON.stringify(new Date().toISOString().split('T')[0]), + }, }, markdown: { remarkPlugins: [remarkRewriteLinks], diff --git a/docs/src/components/Footer.astro b/docs/src/components/Footer.astro index e7ffa8e88..39e68714d 100644 --- a/docs/src/components/Footer.astro +++ b/docs/src/components/Footer.astro @@ -50,6 +50,9 @@ const base = import.meta.env.BASE_URL;
MIT License · Built with Astro
++ v{__VERSION__} · {(__COMMIT_SHA__ as string).slice(0, 7)} · {__BUILD_DATE__} +