From 5d23d0639e0a59478f52120e35c14949569432e3 Mon Sep 17 00:00:00 2001 From: Alexander Lyall Date: Sat, 21 Mar 2026 22:04:49 +0000 Subject: [PATCH] Added versioning information to footer of website. General updates to the release action Signed-off-by: Alexander Lyall --- .gitea/workflows/release.yaml | 86 +++++++++++++++++++++++++++-------- src/layouts/BaseLayout.astro | 10 ++++ 2 files changed, 77 insertions(+), 19 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index f2dbe21..3e1aeda 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -91,27 +91,11 @@ jobs: head -n 60 RELEASE_NOTES.md echo "--------------------------" - - name: Create export zip (Computing:Box Website.zip) - shell: bash - run: | - set -e - if [ ! -d "dist" ]; then - echo "❌ dist/ folder not found in repo root" - ls -la - exit 1 - fi - - rm -f "Computing:Box Website.zip" - (cd dist && zip -r "../Computing:Box Website.zip" .) - test -s "Computing:Box Website.zip" - ls -lh "Computing:Box Website.zip" - - name: Prepare YY.MM.DD letter-suffix tag + release name shell: bash run: | set -e - # Version: YY.MM.DD (UTC). Swap to `date +...` if you prefer UK-local runner time. VERSION="$(date -u +'%y.%m.%d')" PREFIX="v${VERSION}." @@ -135,12 +119,77 @@ jobs: TAG="${PREFIX}${next_letter}" RELEASE_NAME="Computing:Box v${VERSION}.${next_letter}" + origin_url="$(git remote get-url origin)" + + if echo "$origin_url" | grep -q "^git@"; then + host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')" + path="$(echo "$origin_url" | sed -E 's#git@[^:]+:(.*)#\1#')" + origin_url="https://$host/$path" + fi + + base="$(echo "$origin_url" | sed -E 's#(https?://[^/]+)/.*#\1#')" + repo_path="$(echo "$origin_url" | sed -E 's#https?://[^/]+/##')" + repo_path="$(echo "$repo_path" | sed -E 's/\.git$//')" + + RELEASE_URL="${base}/${repo_path}/releases/tag/${TAG}" + echo "TAG=$TAG" >> "$GITHUB_ENV" echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" echo "ZIP_PATH=Computing:Box Website.zip" >> "$GITHUB_ENV" + echo "RELEASE_URL=$RELEASE_URL" >> "$GITHUB_ENV" echo "Using tag: $TAG" echo "Release name: $RELEASE_NAME" + echo "Release URL: $RELEASE_URL" + + - name: Generate version file for Astro footer + shell: bash + run: | + set -e + mkdir -p src/generated + cat > src/generated/version.json </dev/null - echo "✅ Release created: ${RELEASE_NAME} (tag: ${TAG}) with asset uploaded" + echo "✅ Release created: ${RELEASE_NAME} (tag: ${TAG}) with asset uploaded" \ No newline at end of file diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index d0e14ec..3dafc7a 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -1,5 +1,9 @@ --- import "../styles/global.css"; +import versionInfo from "../generated/version.json"; + +const version = versionInfo.version; +const releaseUrl = versionInfo.url; const { title = "Computing:Box" } = Astro.props; --- @@ -60,6 +64,12 @@ const { title = "Computing:Box" } = Astro.props; Legal Code
Computer Science Concept Simulators
+
+ Version: + + {version} + +
© {new Date().getFullYear()} Computing:Box • Created with ♥ by Mr A Lyall