NWChem-wiki mirroring and website update #2264
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: NWChem-wiki mirroring and website update | |
on: | |
push: | |
release: | |
schedule: | |
- cron: '0 0 * * *' | |
repository_dispatch: | |
types: [backend_automation] | |
workflow_dispatch: | |
jobs: | |
mirror_dotwiki2repo: | |
if: | | |
github.event_name == 'schedule' || | |
(!contains(github.event.head_commit.message, 'ci skip')) | |
runs-on: [ubuntu-22.04] | |
steps: | |
- name: Checkout nwchem-wiki | |
uses: actions/checkout@v4 | |
with: | |
repository: nwchemgit/nwchem-wiki | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: fetch and merge | |
run: | | |
git config user.name "nwchemgit" | |
git config user.email "nwchemgit@gmail.com" | |
git config pull.rebase false | |
git remote add upstream https://github.com/nwchemgit/nwchem.wiki > /dev/null 2>&1 | |
git fetch origin | |
git fetch upstream | |
git merge upstream/master --no-edit | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
mirror_repo2dotwiki: | |
if: | | |
github.event_name == 'schedule' || | |
(!contains(github.event.head_commit.message, 'ci skip')) | |
needs: mirror_dotwiki2repo | |
runs-on: [ubuntu-22.04] | |
steps: | |
- name: Checkout nwchem.wiki | |
uses: actions/checkout@v4 | |
with: | |
repository: nwchemgit/nwchem.wiki | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: fetch and merge | |
run: | | |
git config user.name "nwchemgit" | |
git config user.email "nwchemgit@gmail.com" | |
git config pull.rebase false | |
git remote add upstream https://github.com/nwchemgit/nwchem-wiki > /dev/null 2>&1 | |
git fetch origin | |
git fetch upstream | |
git merge upstream/master --no-edit | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.REPOSITORY_TOKEN }} | |
branch: ${{ github.ref }} | |
repository: nwchemgit/nwchem.wiki | |
NWChem_website_update: | |
if: | | |
github.event_name == 'schedule' || | |
(!contains(github.event.head_commit.message, 'ci skip')) | |
needs: mirror_repo2dotwiki | |
runs-on: [ubuntu-22.04] | |
steps: | |
- name: checkout wiki | |
uses: actions/checkout@v4 | |
with: | |
repository: nwchemgit/nwchem-wiki | |
persist-credentials: false | |
fetch-depth: 1 | |
- name: move wiki source under docs | |
shell: bash | |
run: | | |
pwd | |
ls -l | |
mkdir -p mkdocs/docs | |
rsync -a --exclude=.git --exclude=mkdocs * mkdocs/docs/. | |
ls -lrt mkdocs/docs|tail -4 | |
- name: check mkdocs directory | |
shell: bash | |
run: | | |
pwd | |
ls -lart | |
ls -lart mkdocs | |
ls -lart mkdocs/docs | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: install mkdocs and plugins | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
pwd | |
bash ./install_mkdocs.sh | |
mkdocs -V || true | |
- name: checkout archived forum | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
echo " GITHUB_REF_NAME is $GITHUB_REF_NAME" | |
curl -LJ \ | |
https://github.com/nwchemgit/archivedforum/tarball/"$GITHUB_REF_NAME"\ | |
| tar -xz --wildcards \ | |
nwchemgit-archivedforum-*/Special_AWCforum/* | |
mv nwchemgit-archivedforum-* archivedforum | |
pwd | |
- name: move archiveforum source | |
shell: bash | |
working-directory: mkdocs/docs/ | |
run: | | |
echo ' ### ls on mkdocs ###' | |
ls -lart ../ | |
echo ' ### ls on mkdocs/archivedforum ###' | |
ls -lrt ../archivedforum | |
mv ../archivedforum/Special_AWCforum . | |
- name: build website | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
MKDOCS_SERVE=B bash ./build_website.sh | |
ls -lart || true | |
ls -lart site/index.html || true | |
echo github.event_name ${{ github.event_name }} | |
cd site && bash ../remove_polyfill.sh || true | |
- name: write pdf | |
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
cd site | |
tries=1 ; until [ "$tries" -ge 5 ] ; do | |
sudo apt-get -y install libjpeg-turbo8 libpng16-16 fontconfig \ | |
libxext6 libfreetype6 libxrender1 libx11-6 xfonts-75dpi libexpat1 \ | |
libfontenc1 x11-common xfonts-encodings xfonts-base curl && break | |
tries=$((tries+1)) ; echo attempt no. $tries ; sleep 9 ; done | |
curl -LJO \ | |
https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb | |
sudo apt-get -y install libssl3 | |
sudo dpkg -i wkhtmltox_*.deb | |
rm -f wkhtmltox_*.deb | |
wkhtmltopdf --javascript-delay 45000 --enable-local-file-access \ | |
print_page.html nwchemusermanual.pdf | |
ls -l nwchemusermanual.pdf | |
- name: checkout website | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
git clone -b $GITHUB_REF_NAME --depth 1 \ | |
https://github.com/nwchemgit/nwchemgit.github.io | |
- name: update nwchemgit.github.io with new content | |
shell: bash | |
working-directory: mkdocs | |
run: | | |
time -p rsync -W --exclude=.git -a site/* nwchemgit.github.io/. | |
ls -lart site/index.html || true | |
ls -lart nwchemgit.github.io/index.html || true | |
cd nwchemgit.github.io | |
time -p git log -1 | |
- name: Commit changes | |
shell: bash | |
working-directory: mkdocs/nwchemgit.github.io | |
run: | | |
pwd | |
ls -lrt ../ | |
bash ../commit_changes.sh | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
directory: mkdocs/nwchemgit.github.io | |
github_token: ${{ secrets.REPOSITORY_TOKEN }} | |
branch: ${{ github.ref }} | |
repository: nwchemgit/nwchemgit.github.io | |
- name: Check commit result | |
shell: bash | |
working-directory: mkdocs/nwchemgit.github.io | |
run: | | |
git log -10 |