Update CI docs git clone/checkout process.

This commit is contained in:
Kevin Quick 2023-06-21 16:05:37 -07:00
parent 8ef8ef4a82
commit 8fefc47247
No known key found for this signature in database
GPG Key ID: E6D7733599CC0A21

View File

@ -77,8 +77,6 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
env:
# GH_TOKEN is used to enable the `gh repo clone` below.
GH_TOKEN: ${{ github.token }}
# TGTBASE is used below as the working location to checkout and generate
# documentation. Can be changed for convenience.
TGTBASE: docs/ci_build_out
@ -107,44 +105,40 @@ jobs:
run: |
rm -rf ${TGTBASE}
mkdir ${TGTBASE}
gh repo clone ${{ github.repositoryURL }} ${REFREPO}
git -C ${REFREPO} switch --discard-changes master
echo local branches
git -C ${REFREPO} branch -l
echo remote branches
git -C ${REFREPO} branch -l -r
# n.b. do not use github.repositoryURL for checkout: it is
# git:/github.com/owner/repo but that will fail in the context of
# github workflows; use an https reference instead:
git -c protocol.version=2 clone ${{ github.server_url }}/${{ github.repository }} ${REFREPO}
git -C ${REFREPO} fetch --all
for X in $(seq 0 $(( $(cat pulls.json | nix run nixpkgs#jq -- length) - 1))) ; do
prnum=$(cat pulls.json | nix run nixpkgs#jq -- .[${X}].number)
prbr=$(cat pulls.json | nix run nixpkgs#jq -- -r .[${X}].head.ref)
tgt=${TGTBASE}/PR_${prnum}
echo "Checkout Pull Request ${prbr} into PR_${prnum}"
(set -x
mkdir $tgt
git clone -b ${prbr} --single-branch ${REFREPO} ${tgt}
ls -a ${tgt}
echo lbr
git -C ${tgt} branch -l
echo rbr
git -C ${tgt} branch -l -r
echo switch
git -C ${tgt} switch --discard-changes ${prbr}
if [ ! -d ${tgt}/docs/RefMan ] ; then
echo "Removing ${tgt}: no RefMan docs in this version"
rm -rf ${tgt}
fi
)
done
for X in $(seq 0 $(( $(cat tags.json | nix run nixpkgs#jq -- length) - 1))) ; do
tagname=$(cat tags.json | nix run nixpkgs#jq -- -r .[${X}].name)
tgt=${TGTBASE}/${tagname}
echo "Checkout Release Tag ${tagname} into ${tagname}"
mkdir $tgt
# n.b. the switch here is important to make sure the branch is
# present in the clone.
git -C ${REFREPO} switch --discard-changes ${prbr}
git clone ${REFREPO} ${tgt}
git -C ${tgt} checkout --detach ${tagname}
git -C ${tgt} switch --discard-changes ${prbr}
if [ ! -d ${tgt}/docs/RefMan ] ; then
echo "Removing ${tgt}: no RefMan docs in this version"
rm -rf ${tgt}
fi
done
for X in $(seq 0 $(( $(cat tags.json | nix run nixpkgs#jq -- length) - 1))) ; do
tagname=$(cat tags.json | nix run nixpkgs#jq -- -r .[${X}].name)
tgt=${TGTBASE}/${tagname}
echo "Checkout Release Tag ${tagname} into ${tagname}"
git -C ${REFREPO} checkout ${tagname}
git clone ${REFREPO} ${tgt}
git -C ${tgt} checkout ${tagname}
if [ ! -d ${tgt}/docs/RefMan ] ; then
echo "Removing ${tgt}: no RefMan docs in this version"
rm -rf ${tgt}
fi
done
git -C ${REFREPO} switch --discard-changes master
- name: sphinx version config for each doc directory
shell: bash
run: |