initial guidelines for project setup #511
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build LaTeX documents | |
on: | |
workflow_call: | |
inputs: | |
base-version: | |
description: 'A Git ref in the repository istqb_product_base, which should be used for the LaTeX+Markdown template' | |
required: false | |
type: string | |
skip-prerelease: | |
description: 'Whether we should skip creating a prerelease or not' | |
required: false | |
default: false | |
type: boolean | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
permissions: | |
contents: write | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
validate: | |
name: Validate LaTeX, MD, and YAML documents | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/istqborg/istqb_product_base:latest | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set safe Git directory | |
# This should have been done by the previous step. | |
# See also: <https://github.com/actions/checkout/issues/915>. | |
run: | | |
git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Clone repository istqb_product_base | |
run: | | |
set -ex | |
rm -rf /opt/istqb_product_base | |
git clone https://github.com/istqborg/istqb_product_base.git /opt/istqb_product_base | |
cd /opt/istqb_product_base | |
git checkout ${{ inputs.base-version || github.sha }} | |
pip install -r requirements.txt --break-system-packages | |
- name: Validate LaTeX documents | |
run: istqb-template validate-files tex | |
- name: Validate MD documents | |
run: istqb-template validate-files markdown | |
- name: Validate YAML documents | |
run: istqb-template validate-files all-yaml | |
produce-pdf: | |
name: Produce PDF documents | |
needs: | |
- validate | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/istqborg/istqb_product_base:latest | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set safe Git directory | |
# This should have been done by the previous step. | |
# See also: <https://github.com/actions/checkout/issues/915>. | |
run: | | |
git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Clone repository istqb_product_base | |
run: | | |
set -ex | |
rm -rf /opt/istqb_product_base | |
git clone https://github.com/istqborg/istqb_product_base.git /opt/istqb_product_base | |
cd /opt/istqb_product_base | |
git checkout ${{ inputs.base-version || github.sha }} | |
pip install -r requirements.txt --break-system-packages | |
retry -t 30 -d 60 tlmgr install $(sort -u DEPENDS.txt) | |
- name: Compile LaTeX documents to PDF | |
run: istqb-template compile-tex-to-pdf | |
- name: Upload PDF documents | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PDF | |
path: '*.pdf' | |
produce-html: | |
name: Produce HTML documents | |
needs: | |
- validate | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/istqborg/istqb_product_base:latest | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set safe Git directory | |
# This should have been done by the previous step. | |
# See also: <https://github.com/actions/checkout/issues/915>. | |
run: | | |
git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Clone repository istqb_product_base | |
run: | | |
set -ex | |
rm -rf /opt/istqb_product_base | |
git clone https://github.com/istqborg/istqb_product_base.git /opt/istqb_product_base | |
cd /opt/istqb_product_base | |
git checkout ${{ inputs.base-version || github.sha }} | |
pip install -r requirements.txt --break-system-packages | |
retry -t 30 -d 60 tlmgr install $(sort -u DEPENDS.txt) | |
- name: Compile LaTeX documents to HTML | |
run: istqb-template compile-tex-to-html html/ | |
- name: Upload HTML documents | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HTML | |
path: html/ | |
produce-ebooks: | |
name: Produce EPUB documents | |
needs: | |
- validate | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/istqborg/istqb_product_base:latest | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set safe Git directory | |
# This should have been done by the previous step. | |
# See also: <https://github.com/actions/checkout/issues/915>. | |
run: | | |
git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Clone repository istqb_product_base | |
run: | | |
set -ex | |
rm -rf /opt/istqb_product_base | |
git clone https://github.com/istqborg/istqb_product_base.git /opt/istqb_product_base | |
cd /opt/istqb_product_base | |
git checkout ${{ inputs.base-version || github.sha }} | |
pip install -r requirements.txt --break-system-packages | |
retry -t 30 -d 60 tlmgr install $(sort -u DEPENDS.txt) | |
- name: Compile LaTeX documents to EPUB | |
run: istqb-template compile-tex-to-epub epub/ | |
- name: Upload EPUB documents | |
uses: actions/upload-artifact@v4 | |
with: | |
name: EPUB | |
path: epub/ | |
produce-docx: | |
name: Produce DOCX documents | |
needs: | |
- validate | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/istqborg/istqb_product_base:latest | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set safe Git directory | |
# This should have been done by the previous step. | |
# See also: <https://github.com/actions/checkout/issues/915>. | |
run: | | |
git config --global --add safe.directory ${GITHUB_WORKSPACE} | |
- name: Clone repository istqb_product_base | |
run: | | |
set -ex | |
rm -rf /opt/istqb_product_base | |
git clone https://github.com/istqborg/istqb_product_base.git /opt/istqb_product_base | |
cd /opt/istqb_product_base | |
git checkout ${{ inputs.base-version || github.sha }} | |
pip install -r requirements.txt --break-system-packages | |
- name: Convert documents to DOCX | |
run: istqb-template compile-tex-to-docx docx/ | |
- name: Upload DOCX documents | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DOCX | |
path: docx/ | |
prerelease: | |
name: Create a prerelease | |
if: github.ref == 'refs/heads/main' && inputs.skip-prerelease == false | |
needs: | |
- produce-pdf | |
- produce-html | |
- produce-ebooks | |
- produce-docx | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: PDF | |
- name: Create a prerelease | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
title: The latest version | |
automatic_release_tag: latest | |
prerelease: true | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
files: '*.pdf' |