Skip to content

Automatically update Docker Hub descriptions #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/dockerhub-description.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update Docker Hub Description
on:
push:
branches:
- main
paths:
- versions.md
- README.md
- docs/**/*

workflow_dispatch:

jobs:
updateDescriptions:
name: Update description
runs-on: ubuntu-latest
strategy:
matrix:
image:
- minimal
- core
- latex
- extra
- typst

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pandoc
uses: pandoc/actions/setup@v1

- name: Short description
id: config
run: |
printf 'short_description=%s\n' \
"$(pandoc lua docs/scripts/short-description.lua \
${{ matrix.image }})" \
>> $GITHUB_OUTPUT


- name: Generate README files
run: |
make docs-${{ matrix.image }} > /tmp/README.${{ matrix.image }}.md

- name: Update ${{ matrix.image }}
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: pandoc/${{ matrix.image }}
readme-filepath: /tmp/README.${{ matrix.image }}.md
short-description: ${{ steps.config.outputs.short_description }}
24 changes: 24 additions & 0 deletions docs/scripts/short-description.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- short-description.lua: get the short description for a repository
--- Author: Albert Krewinkel <albert+pandoc@tarleb.com>
--- License: MIT

local io = require 'io'
local pandoc = require 'pandoc'

local stringify = pandoc.utils.stringify

--- Command-line arguments
local arg = arg

--- The image type / repository name
local repo = assert(arg[1], "Repository name is required")
local inputfile = arg[2] or 'docs/short-descriptions.md'
local fh = io.open(inputfile, 'r')
local contents = fh:read('a')
fh:close()

local doc = pandoc.read(contents)

assert(doc.meta[repo], "No description found for repository " .. repo)

print(stringify(doc.meta[repo]))
18 changes: 18 additions & 0 deletions docs/short-descriptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
minimal: >-
Minimal image for pandoc, the universal document converter.

core: >-
Official pandoc image with image conversion tools and pandoc-crossref.

latex: >-
Official pandoc image with pandoc, pandoc-crossref, and a minimal LaTeX
installation.

extra: >-
Large pandoc image with many LaTeX extras, including popular fonts and the
"Eisvogel" template.

typst: >-
Document conversion with pandoc, pandoc-crossref, and Typst.
---