Clean up the template #254
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
name: build and publish | |
on: | |
release: | |
types: [published] | |
push: | |
branches: main | |
pull_request: | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-container: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Set up QEMU for cross-platform builds below | |
- name: Set up QEMU | |
if: github.event_name == 'release' | |
uses: docker/setup-qemu-action@v1 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Setup Docker buildx | |
if: github.event_name == 'release' | |
uses: docker/setup-buildx-action@v2 | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
if: github.event_name == 'release' | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
# Login against a Docker registry | |
# https://github.com/docker/login-action | |
- name: Log into registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build just the amd64 container to validate the build | |
# https://github.com/docker/build-push-action | |
# Upload it as "test" so we can use it to render samples | |
- name: Build Docker image | |
if: github.event_name != 'release' | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/trustedcomputinggroup/pandoc_test | |
# Build and push Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and publish Docker image | |
if: github.event_name == 'release' | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
# Push only if releasiing | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
render-samples: | |
if: github.event_name != 'release' | |
needs: build-container | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/trustedcomputinggroup/pandoc_test | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Run the action on sample1 | |
uses: trustedcomputinggroup/markdown@latest | |
with: | |
input-md: sample1.md | |
output-pdf: sample1.pdf | |
output-tex: sample1.tex | |
- name: Run the action on sample2 | |
uses: trustedcomputinggroup/markdown@latest | |
with: | |
input-md: sample2.md | |
output-pdf: sample2.pdf | |
output-tex: sample2.tex | |
- name: Run the action on sample3 | |
uses: trustedcomputinggroup/markdown@latest | |
with: | |
input-md: sample3.md | |
output-pdf: sample3.pdf | |
output-tex: sample3.tex | |
- name: Upload Artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: samples | |
path: | | |
sample*.pdf | |
sample*.tex |