Publish script: avoid need to purge gh image cache

By using a raw.githubusercontent.com url, github no longer uses the camo
cache, and so I can avoid bothering with cache clearing.
This commit is contained in:
TEC 2021-01-24 00:19:26 +08:00
parent 54e617139c
commit d95df6a76a
Signed by: tec
GPG Key ID: 779591AFDB81F06C
3 changed files with 1 additions and 28 deletions

View File

@ -64,7 +64,3 @@ jobs:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./publish
force_orphan: true
- name: Clear cached images
if: ${{ github.event_name != 'pull_request'}}
run: ~/.config/doom/misc/config-publishing/clear-github-cached-images.sh

View File

@ -5,7 +5,7 @@
[[https://img.shields.io/badge/Emacs-27.1-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white]]
[[https://img.shields.io/github/workflow/status/tecosaur/emacs-config/Publish/master.svg?style=flat-square]]
[[https://tecosaur.github.io/emacs-config/misc/pkg-status.svg]]
[[https://raw.githubusercontent.com/tecosaur/emacs-config/gh-pages/misc/pkg-status.svg]]
:end:

View File

@ -1,23 +0,0 @@
#!/usr/bin/env sh
":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
(setq log-file (format "%s-log.txt" (file-name-base load-file-name)))
(load (expand-file-name "initialise.el" (file-name-directory load-file-name)) nil t)
(initialise)
(let (relevant-lines)
(with-current-buffer (url-retrieve-synchronously "https://github.com/tecosaur/emacs-config/blob/master/README.org")
(while (search-forward "data-canonical-src=\"https://tecosaur.github.io/emacs-config/" nil t)
(push (thing-at-point 'line) relevant-lines)))
(dolist (line relevant-lines)
(when-let ((cached-img (when (string-match "href=\"\\([^\"]+\\)\"" line)
(match-string 1 line))))
(let ((url-request-method "PURGE"))
(message "[36] Asking github to purge %s" cached-img)
(with-current-buffer
(url-retrieve-synchronously cached-img)
(message "%s" (buffer-string)))))))
(setq inhibit-message t)
(kill-emacs exit-code)