Refactor GitHub workflows
This mostly simplifies our GitHub actions, but also fixes recent breaking in the release workflows, unifies the tagged and nightly release workflows, and moves to using `gh release` to manage releases. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
73
.github/workflows/userdocs.yml
vendored
Normal file
73
.github/workflows/userdocs.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
---
|
||||
name: userdocs
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'v4.*.x'
|
||||
paths:
|
||||
- 'userdocs/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'v4.*.x'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: ${{ github.repository_owner == 'warewulf' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v5
|
||||
|
||||
- name: prepare
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -f -y texlive-latex-extra latexmk graphviz pandoc
|
||||
pip install --user --upgrade --upgrade-strategy eager sphinx sphinx-rtd-theme restructuredtext_lint pygments sphinx_reredirects
|
||||
|
||||
- name: make generated docs
|
||||
run: |
|
||||
make docs
|
||||
mkdir -p userdocs/reference/man5
|
||||
for f in docs/man/man5/*.5
|
||||
do
|
||||
title="$(basename "${f%.5}")"'(5)'
|
||||
output="userdocs/reference/man5/$(basename "${f%.5}.rst")"
|
||||
line=$(printf '=%.0s' $(seq ${#title}))
|
||||
printf "%s\n%s\n%s\n\n" "$line" "$title" "$line" > "$output"
|
||||
pandoc -f man -t rst "$f" >> "$output"
|
||||
done
|
||||
|
||||
- name: build userdocs
|
||||
run: |
|
||||
make -C userdocs html
|
||||
|
||||
- name: publish docs to github.com/warewulf/warewulf.org
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
echo "${{ secrets.GH_DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
cat <<EOT >> ~/.ssh/config
|
||||
Host github.com
|
||||
HostName github.com
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
EOT
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "gh-actions"
|
||||
git clone git@github.com:warewulf/warewulf.org.git ~/warewulf-web
|
||||
mkdir -p ~/warewulf-web/static/docs
|
||||
rm -rf ~/warewulf-web/static/docs/${GITHUB_REF##*/}
|
||||
cp -r userdocs/_build/html ~/warewulf-web/static/docs/${GITHUB_REF##*/}
|
||||
cd ~/warewulf-web
|
||||
git add static/docs/${GITHUB_REF##*/}
|
||||
git commit -m "Update ${GITHUB_REF##*/} docs"
|
||||
git push
|
||||
Reference in New Issue
Block a user