From 043d4d5fbee27aaeaf42de970031019a89673176 Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Fri, 8 Aug 2025 10:21:40 +0200 Subject: [PATCH] Adapt for the modern world (but still python 3.6 for now) --- .github/workflows/build-and-deploy.yml | 64 +++++++++++++++++++++++++ .gitmodules | 8 ++-- .travis.yml | 46 ------------------ deploy-key.enc | Bin 3248 -> 0 bytes extras/pelican-plugins | 2 +- make.py | 4 +- noleaky | 4 -- requirements.in | 8 ++++ requirements.txt | 57 ++++++++++++++++++++++ 9 files changed, 136 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/build-and-deploy.yml delete mode 100644 .travis.yml delete mode 100644 deploy-key.enc delete mode 100755 noleaky create mode 100644 requirements.in create mode 100644 requirements.txt diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml new file mode 100644 index 0000000..260df28 --- /dev/null +++ b/.github/workflows/build-and-deploy.yml @@ -0,0 +1,64 @@ +name: Build and Deploy to GitHub Pages + +on: + push: + branches: [ source ] + pull_request: + branches: [ source ] + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.7" + + - name: Install dependencies + run: | + pip install -r requirements.txt + # tidy-html5 needs to be installed separately via system package manager + sudo apt-get update && sudo apt-get install -y tidy + + - name: Patch nbconvert to fix filename conflicts + run: | + # Find nbconvert's extractoutput.py and apply the fix + NBCONVERT_PATH=$(python -c "import nbconvert.preprocessors.extractoutput as e; print(e.__file__)") + sed -i 's/if filename in resources\['\''outputs'\''\]:/if filename in resources['\''outputs'\''] and False:/' "$NBCONVERT_PATH" + echo "Applied nbconvert patch to disable duplicate filename check" + + - name: Build site + run: | + python make.py publish + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./output_branch + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/source' + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitmodules b/.gitmodules index 6dfcf3c..d46862e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,16 +12,16 @@ url = https://gist.github.com/6139282.git [submodule "content/notebooks/xkcd_font_glyph_extract"] path = content/notebooks/xkcd_font_glyph_extract - url = git@gist.github.com:b80e3b3ab9edbda9ac4304f742cf292b.git + url = https://gist.github.com/b80e3b3ab9edbda9ac4304f742cf292b.git [submodule "content/notebooks/xkcd_font_stroke_classification"] path = content/notebooks/xkcd_font_stroke_classification url = https://gist.github.com/pelson/1d6460289f06acabb650797b88c15ae0 [submodule "content/notebooks/xkcd_font_svg_and_creation"] path = content/notebooks/xkcd_font_svg_and_creation - url = git@gist.github.com:18434e3bd37dcde8dd28a5a24def0060.git + url = https://gist.github.com/18434e3bd37dcde8dd28a5a24def0060.git [submodule "content/field_notes/lfric_containment"] path = content/field_notes/lfric_containment - url = git@gist.github.com:26b288663d67f8a418cfd7e023520e3c.git + url = https://gist.github.com/26b288663d67f8a418cfd7e023520e3c.git [submodule "content/field_notes/coast_path_pt1"] path = content/field_notes/coast_path_pt1 - url = git@gist.github.com:21fbdc5a944f478bdd896faa95ab3cc7.git + url = https://gist.github.com/21fbdc5a944f478bdd896faa95ab3cc7.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1274cda..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: python - -env: - global: - # travis encrypt GIT_EMAIL= GH_TOKEN= - secure: muOdofd/oT849Qe5iFtEjn11vvOQUvYXCJ9gN+/K0TS9wUX9+QDk3qoTRKoyBKw8EAVfNT6wcfESRoRh8iug1YHUweKPlxUgoqzqTzT3ailxC2qX6n79lqaAyRK+AeclDZGH0ESze8wNZYZzKanicC3X84GVYJpst+DiEDue3MM= - -branches: - only: - - source - -git: - submodules: false - -sudo: false - -install: -- set -e -- openssl aes-256-cbc -K $encrypted_9f32b8d262b8_key -iv $encrypted_9f32b8d262b8_iv -in deploy-key.enc -out deploy-key -d -- chmod 600 deploy-key && eval `ssh-agent -s` && ssh-add deploy-key -- git config --global user.name "Phil Elson" -- git config --global user.email $GIT_EMAIL - -- export CONDA_BASE=http://repo.continuum.io/miniconda/Miniconda3 -- wget ${CONDA_BASE}-latest-Linux-x86_64.sh -O miniconda.sh; -- bash miniconda.sh -b -p $HOME/miniconda -- export PATH="$HOME/miniconda/bin:$PATH:$(pwd)" -- conda config --set show_channel_urls True -- conda install --yes --quiet -c conda-forge conda-execute conda=4.5.3 - -- noleaky git submodule update --quiet --init --recursive -- noleaky git clone --depth=50 --branch=master git@github.com:pelson/pelson.github.io.git output_branch - -- echo "Built from the following commits:" -- git log --oneline -n 1 >> log_message.txt -- LOG_MESSAGE=$(cat log_message.txt) - - -script: - -- conda execute -v make.py publish -- cd output_branch -- git add --all * -- git status -- git commit -am "${LOG_MESSAGE}" -- noleaky git push origin master diff --git a/deploy-key.enc b/deploy-key.enc deleted file mode 100644 index 9114d001d6147f95fe4576e15858edc0808416fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3248 zcmV;h3{Ug79mr47PA&{+CAzUJ7-*5;V3NDi#{jBf(>XUZ3IroicATTFxzGo^3Jv_n z^&#xz2AIBC1zBxYkCe28^@T>REM za6x|#Dod7jgpkCI0T~52u21cO%6LNBkHRRwyQ^>y^uT?~p9p@bP&i|S91Kgi>AoqO zEOXdb5?)`UatM{?#*%20U>EH{wbfjkdEt9_@a9bPN_x18*wXAIE05aGBs6L}T%G82x0N!AY zgvRTR>%p1WTTQnF%tio-zsE}c>^7&RWm|*iq->MNw^*vqXlO?S#*@~duoP^iQI(*dhq&KNV4>%I&yqmxwxdqi zbt!(rEyXaeo#uzMMxgucTBM{GicDw`So%>HtK8Qw?=%5hH7SillXTR{pJ{^3^}(CzopLoh>_J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9*CT^cm*`G9SB z5-aKqTh8f8w#s2sGqn_POVe0UnfE^T<&z)IX`J@=i+n0dD!h*^gd3(UcZP-Lw iIpg&<-WA7djEQD-=L2@h2b4_%H}6|hX8dk(H#Hr&s%6mt diff --git a/extras/pelican-plugins b/extras/pelican-plugins index c0d0756..1958d21 160000 --- a/extras/pelican-plugins +++ b/extras/pelican-plugins @@ -1 +1 @@ -Subproject commit c0d0756776a8ff65069de3601a0a880c7fe74a3f +Subproject commit 1958d21ba0563edb00e7571fc28ecd987047ad76 diff --git a/make.py b/make.py index 412ea33..ddcdda0 100755 --- a/make.py +++ b/make.py @@ -62,7 +62,7 @@ def publish(): new = os.path.join(new_root, fname) if fname.endswith('.html'): print('\nConverting {}:'.format(old)) - cmd = ['tidy5', '-config', 'tidy_config.txt', old] + cmd = ['tidy', '-config', 'tidy_config.txt', old] with open(new, 'w') as fh: try: code = subprocess.check_call(cmd, stdout=fh) @@ -77,7 +77,7 @@ def publish(): if os.path.isdir(fname): shutil.copytree(fname, os.path.join('output_branch', os.path.basename(fname))) elif fname.endswith('.html'): - cmd = ['tidy5', '-config', 'tidy_config.txt', fname] + cmd = ['tidy', '-config', 'tidy_config.txt', fname] with open(os.path.join('output_branch', os.path.basename(fname)), 'w') as fh: subprocess.check_call(cmd, stdout=fh) else: diff --git a/noleaky b/noleaky deleted file mode 100755 index d8d7d25..0000000 --- a/noleaky +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -"$@" 2>&1 | sed -e "s:${GH_TOKEN}::g"; -exit $? diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..e51d57b --- /dev/null +++ b/requirements.in @@ -0,0 +1,8 @@ +pelican==3.7 +markdown<3.0 +ipython==3.* +notebook +nbconvert==5.* +pygments +jinja2<3.0 +markupsafe<2.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0cd28aa --- /dev/null +++ b/requirements.txt @@ -0,0 +1,57 @@ +anyio==3.7.1 +argon2-cffi==23.1.0 +argon2-cffi-bindings==21.2.0 +attrs==24.2.0 +bleach==6.0.0 +blinker==1.6.3 +cffi==1.15.1 +defusedxml==0.7.1 +docutils==0.20.1 +entrypoints==0.4 +exceptiongroup==1.3.0 +fastjsonschema==2.21.1 +feedgenerator==2.1.0 +idna==3.10 +importlib-metadata==6.7.0 +importlib-resources==5.12.0 +ipykernel==4.0.1 +ipython==3.2.3 +ipython-genutils==0.2.0 +Jinja2==2.11.3 +jsonschema==4.17.3 +jupyter-server==1.15.6 +jupyter_client==7.4.9 +jupyter_core==4.12.0 +Markdown==2.6.11 +MarkupSafe==1.1.1 +mistune==0.8.4 +nbclassic==1.2.0 +nbconvert==5.6.1 +nbformat==5.8.0 +nest-asyncio==1.6.0 +notebook==6.5.7 +notebook_shim==0.2.4 +packaging==24.0 +pandocfilters==1.5.1 +pelican==3.7.0 +pkgutil_resolve_name==1.3.10 +prometheus-client==0.17.1 +ptyprocess==0.7.0 +pycparser==2.21 +Pygments==2.17.2 +pyrsistent==0.19.3 +python-dateutil==2.9.0.post0 +pytz==2025.2 +pyzmq==26.2.1 +Send2Trash==1.8.3 +six==1.17.0 +sniffio==1.3.1 +terminado==0.17.1 +testpath==0.6.0 +tornado==6.2 +traitlets==5.9.0 +typing_extensions==4.7.1 +Unidecode==1.4.0 +webencodings==0.5.1 +websocket-client==1.6.1 +zipp==3.15.0