https://github.com/redhat-documentation/redhat-docs-pdf-template
Simple containerized asciidoctor-pdf build that you can use build a Red Hat themed PDF
https://github.com/redhat-documentation/redhat-docs-pdf-template
Last synced: about 1 year ago
JSON representation
Simple containerized asciidoctor-pdf build that you can use build a Red Hat themed PDF
- Host: GitHub
- URL: https://github.com/redhat-documentation/redhat-docs-pdf-template
- Owner: redhat-documentation
- License: mit
- Created: 2023-06-07T08:56:23.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-29T11:56:10.000Z (almost 2 years ago)
- Last Synced: 2025-03-30T18:34:20.935Z (about 1 year ago)
- Language: Shell
- Homepage:
- Size: 313 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
== About
A simple containerized `asciidoctor-pdf` build that you can use build a Red Hat themed PDF.
== Prerequisites
* Install Podman
* Add the following line to your source repo `.gitignore` and commit the change:
+
[source,text]
----
pdf-assets
----
== Running the build locally
. Open a shell prompt at the folder containing your assembly.
. Pull the container image with Podman:
+
[source,terminal]
----
$ podman pull quay.io/redhat-docs/redhat-docs-pdf-template
----
. Load the build assets to the local context:
+
[source,terminal]
----
$ podman cp $(podman run --detach quay.io/redhat-docs/redhat-docs-pdf-template):/pdf-assets ./pdf-assets
----
. Optional. Add a custom SVG format logo:
+
[source,terminal]
----
$ cp pdf-assets/images/logo.svg
----
. Run the build:
+
[source,terminal]
----
$ podman run --rm -it -v "$(pwd)":/docs:Z quay.io/redhat-docs/redhat-docs-pdf-template
----
+
[NOTE]
====
Pass optional Asciidoctor format build parameters by using the `-a` switch. For example:
[source,terminal]
----
$ podman run --rm -it -v "$(pwd)":/docs:Z quay.io/redhat-docs/redhat-docs-pdf-template main.adoc -a internal
----
====
== Using the container build in a GitHub action
Copy the following YAML to the `.github/workflows/build-pdf-release.yml` file in your repository.
Commit and push the changes to create the PDF as a GitHub release artifact.
.Example build-pdf-release.yml
[source,yaml]
----
name: Build and deploy PDF
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Extract assets
run: docker cp $(docker run --detach quay.io/redhat-docs/redhat-docs-pdf-template):/pdf-assets ./pdf-assets
- name: Build PDF
uses: docker://quay.io/redhat-docs/redhat-docs-pdf-template
with:
args: main.adoc
- name: Create PDF release
run: |
echo $GITHUB_RUN_NUMBER > version.txt
mv main.pdf redhat-docs-pdf-template.pdf
gh release create v$GITHUB_RUN_NUMBER redhat-docs-pdf-template.pdf
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
----
== Using the container build in a GitLab pipeline
Copy the following YAML to the `.gitlab-ci.yml` file in your repository root. Adjust as required. Commit and push the changes to deploy the site using GitLab pages.
Build assumes `main.adoc` is in the project root.
.Example .gitlab-ci.yml
[source,yaml]
----
image:
name: quay.io/redhat-docs/redhat-docs-pdf-template
entrypoint: [""]
pages:
stage: deploy
before_script:
- cp -r /pdf-assets pdf-assets
script:
- /build.sh main.adoc
artifacts:
paths:
- ./main.pdf
only:
- main
tags:
- shared
- docker
----