From 87e1b93c4f82b388d5ab25d8d7ddaba2a59daf53 Mon Sep 17 00:00:00 2001 From: Matteo Delucchi Date: Wed, 4 Mar 2026 15:34:45 +0100 Subject: [PATCH] CI for all three forges: build README.html and publish as artifact --- .forgejo/workflows/build-readme.yml | 30 +++++++++++++++++++++++++++++ .gitea/workflows/build-readme.yml | 26 +++++++++++++++++++++++++ .gitlab-ci.yml | 15 +++++++++++++++ scripts/build_readme.sh | 20 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 .forgejo/workflows/build-readme.yml create mode 100644 .gitea/workflows/build-readme.yml create mode 100644 .gitlab-ci.yml create mode 100755 scripts/build_readme.sh diff --git a/.forgejo/workflows/build-readme.yml b/.forgejo/workflows/build-readme.yml new file mode 100644 index 0000000..9a03c81 --- /dev/null +++ b/.forgejo/workflows/build-readme.yml @@ -0,0 +1,30 @@ +name: Build README.html + +on: + push: + branches: ["**"] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + container: + image: pandoc/core:3.1 + + steps: + - name: Checkout + # Forgejo documents that actions/checkout can be referenced via DEFAULT_ACTIONS_URL, + # or explicitly via a Forgejo-hosted URL. + uses: actions/checkout@v4 + # Alternatively: + # uses: https://data.forgejo.org/actions/checkout@v4 + + - name: Build README.html + run: ./scripts/build_readme.sh + + - name: Upload artifact + # Forgejo docs recommend v3 (or patched v4). + uses: https://code.forgejo.org/actions/upload-artifact@v3 + with: + name: README-html + path: README.html diff --git a/.gitea/workflows/build-readme.yml b/.gitea/workflows/build-readme.yml new file mode 100644 index 0000000..406b859 --- /dev/null +++ b/.gitea/workflows/build-readme.yml @@ -0,0 +1,26 @@ +name: Build README.html + +on: + push: + branches: ["**"] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + container: + image: pandoc/core:3.1 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build README.html + run: ./scripts/build_readme.sh + + # If Gitea instance can fetch GitHub actions: + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: README-html + path: README.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..caad72a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,15 @@ +stages: [build] + +build_readme_html: + stage: build + image: pandoc/core:3.1 + rules: + - if: $CI_PIPELINE_SOURCE == "push" + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + script: + - ./scripts/build_readme.sh + artifacts: + name: "readme-html-$CI_COMMIT_SHORT_SHA" + paths: + - README.html + expire_in: 30 days diff --git a/scripts/build_readme.sh b/scripts/build_readme.sh new file mode 100755 index 0000000..d11f639 --- /dev/null +++ b/scripts/build_readme.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +in="README.md" +out="README.html" + +if [[ ! -f "$in" ]]; then + echo "ERROR: $in not found" >&2 + exit 1 +fi + +# GitHub-flavored Markdown -> standalone HTML +pandoc "$in" \ + --from=gfm \ + --to=html5 \ + --standalone \ + --metadata title="README" \ + --output "$out" + +echo "Built $out"