Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 75a5935

Browse files
committedFeb 10, 2025··
Automatically update descriptions on Docker Hub
1 parent 733f258 commit 75a5935

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
 

Diff for: ‎.github/workflows/dockerhub-description.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Update Docker Hub Description
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- versions.md
8+
- README.md
9+
- docs/**/*
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
updateDescriptions:
15+
name: Update description
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
image:
20+
- minimal
21+
- core
22+
- latex
23+
- extra
24+
- typst
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup pandoc
31+
uses: pandoc/actions/setup@v1
32+
33+
- name: Short description
34+
id: config
35+
run: |
36+
printf 'short_description=%s\n' \
37+
"$(pandoc lua docs/scripts/short-description.lua \
38+
${{ matrix.image }})" \
39+
>> $GITHUB_OUTPUT
40+
41+
42+
- name: Generate README files
43+
run: |
44+
make docs-${{ matrix.image }} > /tmp/README.${{ matrix.image }}.md
45+
46+
- name: Update ${{ matrix.image }}
47+
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae
48+
with:
49+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
50+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
51+
repository: pandoc/${{ matrix.image }}
52+
readme-filepath: /tmp/README.${{ matrix.image }}.md
53+
short-description: ${{ steps.config.outputs.short_description }}

Diff for: ‎docs/scripts/short-description.lua

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- short-description.lua: get the short description for a repository
2+
--- Author: Albert Krewinkel <albert+pandoc@tarleb.com>
3+
--- License: MIT
4+
5+
local io = require 'io'
6+
local pandoc = require 'pandoc'
7+
8+
local stringify = pandoc.utils.stringify
9+
10+
--- Command-line arguments
11+
local arg = arg
12+
13+
--- The image type / repository name
14+
local repo = assert(arg[1], "Repository name is required")
15+
local inputfile = arg[2] or 'docs/short-descriptions.md'
16+
local fh = io.open(inputfile, 'r')
17+
local contents = fh:read('a')
18+
fh:close()
19+
20+
local doc = pandoc.read(contents)
21+
22+
assert(doc.meta[repo], "No description found for repository " .. repo)
23+
24+
print(stringify(doc.meta[repo]))

0 commit comments

Comments
 (0)
Please sign in to comment.