docs: local publish script for Codeberg Pages; drop inert CI workflow
Codeberg doesn't execute Forgejo Actions (no runners), so the docs.yml workflow never ran. Replace it with scripts/publish-docs.sh: build the mdBook and force-push docs/book/ to the `pages` branch that Codeberg Pages serves. Installs mdbook on demand, derives the Pages URL from the origin remote, and honors CODEBERG_TOKEN for non-interactive auth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0861c8e394
commit
9da16ca65f
2 changed files with 83 additions and 44 deletions
|
|
@ -1,44 +0,0 @@
|
|||
# Build the mdBook docs and publish them to Codeberg Pages.
|
||||
#
|
||||
# Codeberg serves the `pages` branch of a repo (or a dedicated `pages`
|
||||
# repo) at https://<user>.codeberg.page/<repo>/. This workflow builds the
|
||||
# book on a push to main that touches docs/ and pushes the rendered HTML
|
||||
# to the `pages` branch.
|
||||
name: docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.forgejo/workflows/docs.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: rust:1.85-bookworm
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install mdBook
|
||||
run: cargo install mdbook --no-default-features --features search
|
||||
|
||||
- name: Build the book
|
||||
run: mdbook build docs
|
||||
|
||||
- name: Publish to the pages branch
|
||||
# forgejo-release isn't right here; push the built docs/book/ to a
|
||||
# `pages` branch that Codeberg Pages serves. Uses the repo token.
|
||||
env:
|
||||
TOKEN: ${{ secrets.PAGES_TOKEN }}
|
||||
run: |
|
||||
cd docs/book
|
||||
git init -q
|
||||
git config user.name "ci"
|
||||
git config user.email "ci@localhost"
|
||||
git add -A
|
||||
git commit -q -m "docs build ${{ github.sha }}"
|
||||
git push -f "https://x:${TOKEN}@codeberg.org/${{ github.repository }}.git" HEAD:pages
|
||||
Loading…
Add table
Add a link
Reference in a new issue