CI for all three forges: build README.html and publish as artifact
Some checks failed
Build README.html / build (push) Has been cancelled
Some checks failed
Build README.html / build (push) Has been cancelled
This commit is contained in:
parent
aba8f4aab9
commit
87e1b93c4f
30
.forgejo/workflows/build-readme.yml
Normal file
30
.forgejo/workflows/build-readme.yml
Normal file
@ -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
|
||||||
26
.gitea/workflows/build-readme.yml
Normal file
26
.gitea/workflows/build-readme.yml
Normal file
@ -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
|
||||||
15
.gitlab-ci.yml
Normal file
15
.gitlab-ci.yml
Normal file
@ -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
|
||||||
20
scripts/build_readme.sh
Executable file
20
scripts/build_readme.sh
Executable file
@ -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"
|
||||||
Loading…
x
Reference in New Issue
Block a user