Files
chemenu/.gitea/workflows/wiki-mirror.yml
T
torbenandClaude Code 90ea0eea1b
CI / verify (push) Successful in 6m22s
CI / pwsh (push) Successful in 2m24s
Release / release (push) Successful in 34s
Release / wiki-mirror (push) Skipped
feat(workflow): Gitea-Wiki als generierter Spiegel von docs/ (#192)
Konverter .gitea/scripts/wiki_mirror.py, Push-Skript wiki-push.sh, Job wiki-mirror in release.yml, Dispatch-Workflow wiki-mirror.yml und --check-Schritt in ci.yml. Version 9.0.0-beta.13.

Files changed:
- .gitea/scripts/wiki-push.sh
- .gitea/scripts/wiki_mirror.py
- .gitea/workflows/ci.yml
- .gitea/workflows/release.yml
- .gitea/workflows/wiki-mirror.yml
- CHANGES.md
- README.md
- VERSION
- docs/dev/development.md
- tools/chemenu/tests/test_wiki_mirror.py

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnAJ7Z3CpVD3PRbN73QtU2
2026-10-07 23:10:19 +02:00

79 lines
2.6 KiB
YAML

# Mirror the docs of one release tag into the Gitea wiki, by hand.
#
# The same two scripts as the `wiki-mirror` job in release.yml, started on demand:
# to fill the wiki for the first time and look at it before the next release,
# and to catch up a mirror that failed after its release was already published.
# The wiki is a mirror and never a source - every run replaces its whole content,
# and nothing but CI writes to it.
#
# The converter and the push script come from the commit this workflow runs on
# (main); the docs come from the tag, checked out beside it. That way an old tag,
# whose tree predates the converter, can still be mirrored.
#
# Input `tag` defaults to the latest release, read from the release API.
name: Wiki mirror
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag to mirror (default: the latest release)'
required: false
default: ''
jobs:
mirror:
runs-on: linux-docker
container:
image: debian:trixie-slim
permissions:
contents: write
env:
PUBLIC_BASE_URL: https://gitea.nehmer.net
steps:
- name: System dependencies
run: |
set -eu
apt-get update -qq
apt-get install -y --no-install-recommends python3 git nodejs ca-certificates curl jq
rm -rf /var/lib/apt/lists/*
- uses: actions/checkout@v7
- name: Resolve the tag
id: tag
env:
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TOKEN: ${{ gitea.token }}
INPUT_TAG: ${{ github.event.inputs.tag }}
run: |
set -eu
tag="$INPUT_TAG"
if [ -z "$tag" ]; then
tag="$(curl -sS -f -H "Authorization: token ${TOKEN}" "${API}/releases/latest" | jq -r '.tag_name')"
fi
case "$tag" in
v[0-9]*) ;;
*) echo "Tag '${tag}' is not a release tag (vX.Y.Z)."; exit 1 ;;
esac
echo "Mirroring ${tag}."
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v7
with:
ref: ${{ steps.tag.outputs.tag }}
path: tag-tree
- name: Mirror the docs into the wiki
env:
VERSION: ${{ steps.tag.outputs.version }}
WIKI_TOKEN: ${{ gitea.token }}
run: |
set -eu
python3 .gitea/scripts/wiki_mirror.py --source tag-tree --out /tmp/wiki-out \
--version "$VERSION" --repo-url "${PUBLIC_BASE_URL}/${GITHUB_REPOSITORY}"
.gitea/scripts/wiki-push.sh /tmp/wiki-out "$VERSION"