# 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"