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
25 changes: 19 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ on:
release:
types: [published]

# Build the site on pull requests that touch the docs, without deploying it.
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Pull request builds use their own group so they never cancel a pending deployment.
concurrency:
group: pages
cancel-in-progress: false
group: ${{ github.event_name == 'pull_request' && format('docs-pr-{0}', github.ref) || 'pages' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
Expand All @@ -27,33 +34,39 @@ jobs:
if [ "$GITHUB_EVENT_NAME" = "release" ]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION=$(gh release view --json tagName -q .tagName | sed 's/^v//')
# the latest release, including pre-releases (gh release view only returns full releases)
VERSION=$(gh release list --exclude-drafts --limit 1 --json tagName -q '.[0].tagName' | sed 's/^v//')
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Substitute version placeholder
run: find docs -name '*.md' -exec sed -i "s/@VERSION@/$VERSION/g" {} +
run: find docs -name '*.md' -not -path '*/node_modules/*' -exec sed -i "s/@VERSION@/$VERSION/g" {} +
env:
VERSION: ${{ steps.version.outputs.version }}
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Setup Pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v6
- name: Install dependencies
run: npm install
run: npm ci
working-directory: docs
- name: Build with VitePress
run: npm run docs:build
working-directory: docs
- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v5
with:
path: docs/.vitepress/dist

deploy:
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
16 changes: 14 additions & 2 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { defineConfig } from 'vitepress'

const description = "A Redis & Valkey client for Scala 3"

export default defineConfig({
base: '/sage/',
title: "Sage",
description: "A Redis & Valkey client for Scala 3",
description,
head: [
['link', { rel: 'icon', href: '/sage/favicon.png' }],
['script', { defer: '', src: 'https://cloud.umami.is/script.js', 'data-website-id': '2ba71608-2c44-4547-804e-ed78f3a41ad1' }]
['script', { defer: '', src: 'https://cloud.umami.is/script.js', 'data-website-id': '2ba71608-2c44-4547-804e-ed78f3a41ad1' }],
// VitePress does not add `base` to head entries, so these URLs are absolute.
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:url', content: 'https://ghostdogpr.github.io/sage/' }],
['meta', { property: 'og:title', content: 'Sage' }],
['meta', { property: 'og:description', content: description }],
['meta', { property: 'og:image', content: 'https://ghostdogpr.github.io/sage/og.png' }],
['meta', { property: 'og:image:width', content: '1200' }],
['meta', { property: 'og:image:height', content: '630' }],
['meta', { property: 'og:image:alt', content: 'Sage logo (glasses with Scala bars in the lenses) above the title Sage: A Redis & Valkey client for Scala 3' }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }]
],

themeConfig: {
Expand Down
Binary file added docs/public/og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading