Merge pull request #300 from JasonYangShadow/issue/2325 #242
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: publish | |
on: | |
push: | |
branches: | |
- main | |
- 1.* | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'apptainer/apptainer-userdocs' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.9 | |
- name: Update repositories | |
run: | | |
sudo apt update | |
- name: Install Apptainer dependencies | |
run: | | |
sudo apt-get install -f -y build-essential libssl-dev uuid-dev squashfs-tools libseccomp-dev cryptsetup-bin libgpgme-dev | |
- name: Install LaTeX dependencies | |
run: | | |
sudo apt-get install -f -y texlive-latex-extra latexmk | |
- name: Setup Python | |
uses: actions/setup-python@v1 | |
- name: Install Sphinx | |
run: | | |
# docutils==0.16 is a temporary downgrade to fix bullet list rendering | |
# see https://stackoverflow.com/questions/67542699/readthedocs-sphinx-not-rendering-bullet-list-from-rst-file | |
# Once fixed, it can be removed from the list because it is | |
# otherwise an implied dependency | |
pip install --user --upgrade --upgrade-strategy eager docutils==0.16 setuptools sphinx sphinx-rtd-theme restructuredtext_lint pygments m2r2 | |
- name: Build web documentation | |
run: | | |
make html | |
- name: Build PDF documentation | |
run: | | |
make latexpdf | |
- name: Build EPUB documentation | |
run: | | |
make epub | |
- name: Install SSH key | |
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 "[email protected]" | |
git config --global user.name "gh-actions" | |
- name: Update website repo | |
run: | | |
git clone [email protected]:apptainer/apptainer.org.git ~/apptainer.org | |
rm -rf ~/apptainer.org/public/docs/user/${GITHUB_REF##*/} | |
cp -r _build/html ~/apptainer.org/public/docs/user/${GITHUB_REF##*/} | |
cd ~/apptainer.org/public/docs/user/ | |
version=`ls -1 | grep -E "^[0-9\.]+$" | sort -V | tail -n 1` | |
ln -sfn ${version} ~/apptainer.org/public/docs/user/latest | |
cd ~/apptainer.org | |
git add public/docs/user/${GITHUB_REF##*/} public/docs/user/latest | |
git commit -m "Update ${GITHUB_REF##*/} userdocs" | |
git push |