~nabijaczleweli/html-readme

A demo of deploying a custom HTML README
Also link to the source
Fix alignment
Uncat the final product

refs

trunk
browse  log 

clone

read-only
https://git.sr.ht/~nabijaczleweli/html-readme
read/write
git@git.sr.ht:~nabijaczleweli/html-readme

You can also use your local clone with git send-email.

NAME

html-readme - A demo of deploying a custom HTML README

DESCRIPTION

By default, {git,hg,hub}.sr.ht use README or README.md as the README; however, by PUTting some text/html at /api/repos/repo-name/readme, any source format can be used – this README is written in ronn(1) and additionally preprocessed.

FILES

html-readme.md: the ronn(1) source for this README.

.build.yml:

image: debian/bullseye
packages:
  - ronn
  - curl
secrets:
  - 8d4dfb87-e056-4f68-abae-0da7ba5d4398
tasks:
  - build: |
      cd html-readme
      awk '/BUILD_YML_PLACEHOLDER/ {print "_PRE"; while(getline < ".build.yml") print; print "__PRE"; next}  //' html-readme.md | \
      ronn -f | \
      sed -e 's;^__PRE$;</pre>;' -e 's;^_PRE$;<pre>;' > ~/README.html
  - readme: |
      set +x  # Avoid echoing the token
      curl -H "Content-Type: text/html"                      \
           -H "Authorization: Bearer $(cat ~/.readme-token)" \
           -XPUT                                             \
           --data-binary @README.html                        \
           'https://git.sr.ht/api/repos/html-readme/readme' &&
      echo "README set"

Of note:

  • the secret lands in ~/.readme-token,
  • additional care is taken not to echo it – I'd recommend using a separate token for this purpose to make it easier to revoke if it does get leaked.

AUTHOR

Written by наб <nabijaczleweli@nabijaczleweli.xyz>

REPORTING BUGS

<nabijaczleweli@nabijaczleweli.xyz>

SEE ALSO

<https://man.sr.ht/git.sr.ht/#setting-a-custom-readme>