mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-25 05:16:19 -07:00
89 lines
3.0 KiB
YAML
89 lines
3.0 KiB
YAML
name: Docs Pages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
rebuild_archives:
|
|
description: 'Stable tags to rebuild in R2 (comma-separated, or "all"); archives are otherwise built once'
|
|
required: false
|
|
default: ''
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
paths:
|
|
- 'docs-site/**'
|
|
- 'scripts/docs-versioning.ts'
|
|
- 'scripts/docs-versioned-assets.ts'
|
|
- 'scripts/docs-archive-store.ts'
|
|
- 'scripts/build-versioned-docs.ts'
|
|
- '.github/workflows/docs-pages.yml'
|
|
- 'package.json'
|
|
- 'bun.lock'
|
|
|
|
concurrency:
|
|
group: docs-pages-production
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
if: ${{ github.ref_type != 'tag' || !contains(github.ref_name, '-') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Guard stable docs tag shape
|
|
id: tag_guard
|
|
if: github.ref_type == 'tag'
|
|
env:
|
|
TAG_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
if [[ ! "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
echo "::notice::Skipping non-stable docs tag $TAG_NAME"
|
|
echo "stable_tag=false" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
echo "stable_tag=true" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup Bun
|
|
if: steps.tag_guard.outputs.stable_tag != 'false'
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.5
|
|
|
|
- name: Install dependencies
|
|
if: steps.tag_guard.outputs.stable_tag != 'false'
|
|
run: |
|
|
bun install --frozen-lockfile
|
|
cd docs-site && bun install --frozen-lockfile
|
|
|
|
- name: Test docs
|
|
if: steps.tag_guard.outputs.stable_tag != 'false'
|
|
run: bun run docs:test
|
|
|
|
# Builds only archives missing from R2 (plus any requested rebuilds), then the
|
|
# root and /main/ builds that make up the Pages deployment.
|
|
- name: Build versioned docs
|
|
if: steps.tag_guard.outputs.stable_tag != 'false'
|
|
env:
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
DOCS_ARCHIVE_R2_ACCESS_KEY_ID: ${{ secrets.DOCS_ARCHIVE_R2_ACCESS_KEY_ID }}
|
|
DOCS_ARCHIVE_R2_SECRET_ACCESS_KEY: ${{ secrets.DOCS_ARCHIVE_R2_SECRET_ACCESS_KEY }}
|
|
DOCS_ARCHIVE_R2_BUCKET: ${{ vars.DOCS_ARCHIVE_R2_BUCKET }}
|
|
REBUILD_ARCHIVES: ${{ inputs.rebuild_archives }}
|
|
run: bun run scripts/build-versioned-docs.ts --require-archives "--rebuild-archives=${REBUILD_ARCHIVES}"
|
|
|
|
- name: Deploy docs to Cloudflare Pages
|
|
if: steps.tag_guard.outputs.stable_tag != 'false'
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
# Run from docs-site so Wrangler bundles docs-site/functions (the /v/* archive server).
|
|
workingDirectory: docs-site
|
|
command: pages deploy ../.tmp/docs-versioned-site --project-name "${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME }}" --branch main
|