use pandoc action from pandoc repo instead of local path #2
Workflow file for this run
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
# Reusable workflow to render the spec for a variety of purposes. | |
# https://docs.github.com/en/actions/using-workflows/reusing-workflows | |
name: render | |
on: | |
workflow_call: | |
inputs: | |
container: | |
description: the Docker container to use (default is trustedcomputinggroup/pandoc) | |
required: false | |
type: string | |
default: ghcr.io/trustedcomputinggroup/pandoc | |
container-version: | |
description: the released version of the Docker container to use | |
required: true | |
type: string | |
input: | |
description: the Markdown file to render | |
required: true | |
type: string | |
workflow: | |
description: the workflow to run ('pr', 'push', 'release', 'manual') | |
required: true | |
type: string | |
manual_diffbase: | |
description: diffbase for manual workflow | |
required: false | |
type: string | |
revision: | |
description: version to render (defaults is default branch) | |
required: false | |
type: string | |
jobs: | |
render: | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ inputs.container }}:${{ inputs.container-version }} | |
name: Render | |
steps: | |
# Use the input file name (no extension) as the base filename for the output | |
- name: Calculate output file name | |
id: gen_output_name | |
run: | | |
filename=$(basename ${{ inputs.input }}) | |
filename="${filename%.*}" | |
echo OUTPUT_FILENAME="${filename}" >> "$GITHUB_OUTPUT" | |
echo output filename: ${filename} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.revision }} | |
fetch-depth: 0 | |
fetch-tags: true | |
# Cache the LaTeX files. Use input file and container version in the cache | |
# key so that the cache is invalidated upon file change or container | |
# version change. | |
- name: Cache LaTeX files | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-latex-${{ inputs.input }}-files | |
with: | |
path: | | |
*.aux | |
*.fdb_latexmk | |
*.lof | |
*.lot | |
*.toc | |
*.upa | |
*.upb | |
*.convert.pdf | |
*.mermaid.pdf | |
key: latex-${{ inputs.input }}-${{ inputs.container-version }}-${{ github.run_id }} | |
restore-keys: latex-${{ inputs.input }}-${{ inputs.container-version }} | |
# Render the document with diffs in the 'pr' mode. | |
- name: Render | |
if: inputs.workflow == 'pr' | |
uses: trustedcomputinggroup/pandoc/.github/actions/render | |
with: | |
input-md: ${{ inputs.input }} | |
output-basename: ${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }} | |
pdf: true | |
diffbase: "${{ github.event.pull_request.base.sha }}" | |
pr-number: "${{ github.event.number }}" | |
pr-repo: "${{ github.repository }}" | |
# Render the document with diffs in the 'manual' mode. | |
- name: Render | |
if: inputs.workflow == 'manual' | |
uses: trustedcomputinggroup/pandoc/.github/actions/render | |
with: | |
input-md: ${{ inputs.input }} | |
output-basename: ${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }} | |
pdf: true | |
diffbase: "${{ inputs.manual_diffbase }}" | |
# Render the document without diffs in other modes. | |
- name: Render | |
if: inputs.workflow != 'pr' && inputs.workflow != 'manual' | |
uses: trustedcomputinggroup/pandoc/.github/actions/render | |
with: | |
input-md: ${{ inputs.input }} | |
output-basename: ${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }} | |
pdf: true | |
# Upload the PDF to the release in 'release' mode | |
- name: Upload to release | |
if: inputs.workflow == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }}.*.pdf | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
# Always upload all PDF and log files to the workflow artifacts | |
- name: Upload pdfs | |
uses: actions/upload-artifact@master | |
with: | |
name: PDF | |
path: | | |
${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }}.*.pdf | |
if: always() | |
- name: Upload logs | |
uses: actions/upload-artifact@master | |
with: | |
name: Logs | |
path: | | |
${{ steps.gen_output_name.outputs.OUTPUT_FILENAME }}.*.log | |
if: always() |