From cd3cff733b493b102ab8877d36283ca977407f37 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Thu, 7 May 2026 12:26:14 +0200 Subject: [PATCH] ci: preserve download assets on docs deploy --- .github/workflows/deploy-docs.yml | 36 +++++++++++++++++++++++++++++-- site/.vitepress/config.ts | 1 + site/download/index.md | 19 ---------------- site/start/install.md | 2 +- 4 files changed, 36 insertions(+), 22 deletions(-) delete mode 100644 site/download/index.md diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 4c9a1676..7ae7536a 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -43,14 +43,46 @@ jobs: node-version: "22" cache: pnpm + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - name: Setup Pages uses: actions/configure-pages@v5 - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build docs - run: pnpm docs:build + - name: Build docs and download pages + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pnpm docs:build + + DIST="site/.vitepress/dist" + mkdir -p "$DIST/alpha" "$DIST/stable" "$DIST/download" "$DIST/stable/download" + + gh api -H "Accept: application/vnd.github+json" repos/${{ github.repository }}/releases --paginate > "$DIST/releases.json" + + STABLE_TAG="$(gh release list --repo ${{ github.repository }} --limit 100 --json tagName,isDraft,isPrerelease --jq '[.[] | select(.isDraft == false and .isPrerelease == false)][0].tagName // ""')" + if [ -n "$STABLE_TAG" ]; then + gh release download --repo ${{ github.repository }} "$STABLE_TAG" --pattern "stable-latest.json" --output "$DIST/stable/latest.json" || echo '{}' > "$DIST/stable/latest.json" + else + echo '{}' > "$DIST/stable/latest.json" + fi + + ALPHA_TAG="$(gh release list --repo ${{ github.repository }} --limit 100 --json tagName,isDraft,isPrerelease --jq '[.[] | select(.isDraft == false and .isPrerelease == true)][0].tagName // ""')" + if [ -n "$ALPHA_TAG" ]; then + gh release download --repo ${{ github.repository }} "$ALPHA_TAG" --pattern "alpha-latest.json" --output "$DIST/alpha/latest.json" || echo '{}' > "$DIST/alpha/latest.json" + else + echo '{}' > "$DIST/alpha/latest.json" + fi + + bun scripts/build-release-download-page.ts --latest-json "$DIST/stable/latest.json" --releases-json "$DIST/releases.json" --output-file "$DIST/download/index.html" + cp "$DIST/download/index.html" "$DIST/stable/download/index.html" + cp "$DIST/alpha/latest.json" "$DIST/latest.json" + cp "$DIST/alpha/latest.json" "$DIST/latest-canary.json" - name: Upload Pages artifact uses: actions/upload-pages-artifact@v4 diff --git a/site/.vitepress/config.ts b/site/.vitepress/config.ts index 50251999..fe96fed6 100644 --- a/site/.vitepress/config.ts +++ b/site/.vitepress/config.ts @@ -7,6 +7,7 @@ export default defineConfig({ description: "Tolaria is a local-first Markdown knowledge base with native relationships, Git history, and AI workflows.", base, + ignoreDeadLinks: [/^\/download\/?(?:index)?$/], cleanUrls: true, head: [ ["link", { rel: "icon", type: "image/png", href: `${base}landing/favicon.png` }], diff --git a/site/download/index.md b/site/download/index.md deleted file mode 100644 index 0363bf97..00000000 --- a/site/download/index.md +++ /dev/null @@ -1,19 +0,0 @@ -# Download - -Download Tolaria from the latest stable release. - -## Latest Stable - -[Open the installer download page](https://refactoringhq.github.io/tolaria/download/) - -The download page reads the latest stable release metadata and points you to the current macOS, Windows, or Linux artifact. - -## Other Builds - -- [Browse all GitHub releases](https://github.com/refactoringhq/tolaria/releases) -- [Read release history](/releases/) -- [Learn release channels](/reference/release-channels) - -## Verify The Version - -After launching the app, check the version shown in Tolaria's status bar or release surface. diff --git a/site/start/install.md b/site/start/install.md index 24401453..85aa4d95 100644 --- a/site/start/install.md +++ b/site/start/install.md @@ -6,7 +6,7 @@ Tolaria publishes desktop builds for macOS, Windows, and Linux. macOS is the pri Use the latest stable release unless you are intentionally testing pre-release builds: -- [Download the latest stable build](https://refactoringhq.github.io/tolaria/download/) +- [Download the latest stable build](/download/) - [Browse all GitHub releases](https://github.com/refactoringhq/tolaria/releases) - [Read the release notes](/releases/)