Skip to content

Commit

Permalink
feat: make cmd easily configurable
Browse files Browse the repository at this point in the history
fix: use right image url

fix: workdir for actions

fix: image command/entrypoint

fix: add necessary libraries for image generation

fix: chrome installation in the image

build: run only one build concurrently

fix: let puppeteer download the chrome it prefers

s
  • Loading branch information
tssge committed Nov 13, 2023
1 parent 7457130 commit 456dca5
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 6 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create and publish a Docker image
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.vagrant
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM pandoc/latex:2.13

ENV CHROME_BIN="/usr/bin/chromium-browser"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
WORKDIR /action/workspace

RUN apk add --update chromium npm
RUN npm install -g [email protected].5 --unsafe-perm=true
RUN apk add --update npm bash gmp-dev librsvg-dev
RUN npm install -g [email protected].6 --unsafe-perm=true

ENTRYPOINT ["./run-pandoc.sh"]
ENTRYPOINT ["pandoc", "-F", "mermaid-filter", "-o"]
23 changes: 23 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Vagrant.require_version ">= 2.2.4"
Vagrant.configure(2) do |config|
# Base box
config.vm.box = "ubuntu/lunar64"

# Virtual machine details - VirtualBox
config.vm.provider "virtualbox" do |v|
v.gui = false
v.cpus = 4
v.memory = 4096
v.name = "PandocMermaidAction"
v.default_nic_type = "virtio"

if Vagrant::Util::Platform.windows? then
v.customize ["modifyvm", :id, "--uartmode1", "client", "NUL"]
else
v.customize ["modifyvm", :id, "--uartmode1", "file", "/dev/null"]
end
end

# Shared folder owner to ubuntu instead of vagrant
config.vm.synced_folder ".", "/vagrant", name: "vagrant", disabled: false
end
14 changes: 13 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
---
name: 'Pandoc-Mermaid'
description: 'Run pandoc with the mermaid-filter'
inputs:
input-file:
description: 'The input file'
required: false
default: 'README.md'
output-file:
description: 'The output file'
required: false
default: 'README.pdf'
runs:
using: 'docker'
image: 'Dockerfile'
image: 'docker://ghcr.io/net9-oy/pandoc-mermaid-action:main'
args:
- ${{ inputs.output-file }}
- ${{ inputs.input-file }}

0 comments on commit 456dca5

Please sign in to comment.