Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -37,11 +39,43 @@ jobs:
working-directory: docs
run: npm ci

- name: Resolve latest release version
id: resolve_version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# For deployment builds:
# - On release events, use the event's tag name (source of truth for that deployment).
# - On main pushes, resolve the latest release tag from GitHub.
# For pull requests and workflow_dispatch, fall back to "dev" so preview builds still succeed.
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
elif [[ "${{ github.event_name }}" == "push" ]]; then
VERSION=$(gh release view --repo "${{ github.repository }}" --json tagName -q '.tagName' 2>/dev/null || true)
else
VERSION="dev"
fi

if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "release" ]]; then
if [[ -z "$VERSION" ]]; then
echo "ERROR: Could not resolve docs version." >&2
exit 1
fi
if ! [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Resolved version '$VERSION' does not match expected semver format (vX.Y.Z)." >&2
exit 1
fi
fi
echo "Resolved docs version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Prepare logo asset
run: cp assets/clockworks-display-resized.png docs/public/logo.png

- name: Build VitePress site
working-directory: docs
env:
DOCS_VERSION: ${{ steps.resolve_version.outputs.version }}
run: npm run docs:build

- name: Upload Pages artifact
Expand All @@ -51,7 +85,7 @@ jobs:

deploy:
needs: build
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: github-pages
Expand Down
4 changes: 3 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { defineConfig } from 'vitepress'

const docsVersion = process.env.DOCS_VERSION ?? 'dev'

export default defineConfig({
base: '/Clockworks/',
title: 'Clockworks',
Expand Down Expand Up @@ -33,7 +35,7 @@ export default defineConfig({
},
{ text: 'Changelog', link: '/changelog' },
{
text: 'v1.3.0',
text: docsVersion,
link: 'https://github.com/dexcompiler/Clockworks/releases',
target: '_blank',
},
Expand Down
3 changes: 0 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ hero:
name: Clockworks
text: 'Time is just another dependency.'
tagline: 'Deterministic, fully controllable time and time-ordered identifiers for distributed-system simulations and testing. Built on .NET 10 TimeProvider.'
image:
src: /logo.png
alt: Clockworks
actions:
- theme: brand
text: Get Started
Expand Down
Loading