Browse Source

Pull the latest tag from git, on build, and display it top-right on the About page.

master
Silberengel 11 months ago
parent
commit
4a2640e0b4
  1. 6
      src/routes/about/+page.svelte
  2. 17
      vite.config.ts

6
src/routes/about/+page.svelte

@ -1,10 +1,16 @@ @@ -1,10 +1,16 @@
<script lang='ts'>
import { Heading } from "flowbite-svelte";
// Get the git tag version from environment variables
const gitTagVersion = import.meta.env.GIT_TAG || 'development';
</script>
<div class='w-full flex justify-center'>
<main class='main-leather flex flex-col space-y-4 max-w-2xl w-full mt-4 mb-4'>
<div class="flex justify-between items-center">
<Heading tag='h1' class='h-leather mb-2'>About</Heading>
<span class="text-sm bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded">Version: {gitTagVersion}</span>
</div>
<p>Alexandria is a reader and writer for <a href="https://github.com/nostr-protocol/nips/pull/1600" class='underline' target="_blank">curated publications</a> (in Asciidoc), and will eventually also support long-form articles (Markdown) and wiki pages (Asciidoc). It is produced by the <a href="https://wikistr.com/gitcitadel-project" class='underline' target="_blank">GitCitadel project team</a>.</p>
<p>Please submit support issues on the <a href="https://gitcitadel.com/r/naddr1qvzqqqrhnypzplfq3m5v3u5r0q9f255fdeyz8nyac6lagssx8zy4wugxjs8ajf7pqy88wumn8ghj7mn0wvhxcmmv9uqq5emfw33kjarpv3jkcs83wav" class='underline' target="_blank">project repo page</a> and follow us on <a href="https://github.com/ShadowySupercode/gitcitadel" class='underline' target="_blank">GitHub</a> and <a href="https://geyser.fund/project/gitcitadel" class='underline' target="_blank">Geyserfund</a>.</p>

17
vite.config.ts

@ -1,9 +1,26 @@ @@ -1,9 +1,26 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { execSync } from "child_process";
// Function to get the latest git tag
function getLatestGitTag() {
try {
// Get the latest git tag
const tag = execSync('git describe --tags --abbrev=0').toString().trim();
return tag;
} catch (error) {
console.error("Failed to get git tag:", error);
return "unknown";
}
}
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['./tests/unit/**/*.unit-test.js']
},
define: {
// Expose the git tag as a global variable
'import.meta.env.GIT_TAG': JSON.stringify(getLatestGitTag())
}
});

Loading…
Cancel
Save