added auto-generation for svgs
This commit is contained in:
parent
824fba0878
commit
863300c4d8
23
action.yml
23
action.yml
@ -4,16 +4,23 @@ inputs:
|
||||
home-md-file:
|
||||
description: Markdown file of the page you see when accessing the published site
|
||||
required: false
|
||||
dark-mode:
|
||||
description: If drawings should be exported in dark mode
|
||||
required: false
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
# Semantic version range syntax or exact version of a Python version
|
||||
python-version: '3.12'
|
||||
# Optional - x64 or x86 architecture, defaults to x64
|
||||
architecture: 'x64'
|
||||
- run: python ${{ github.action_path }}/main.py "${{ github.workspace }}" "${{ github.workspace }}/${{ inputs.home-md-file}}"
|
||||
- name: Start containers
|
||||
run: docker-compose -f "${{ github.action_path }}/docker-compose.yml" up -d --build
|
||||
shell: bash
|
||||
- name: Creating SVG files
|
||||
run: find "${{ github.workspace }}" -type f -name '*.excalidraw' -exec bash "${{ github.action_path }}/to_svg.sh" "{}" ${{ input.dark-mode == 'true' }} ";"
|
||||
shell: bash
|
||||
- name: Replace excalidraw file references
|
||||
run: find "${{ github.workspace }}" -type f -name '*.md' -exec sed -ri 's|(\[\[.*\.excalidraw)(\]\])|\1.csv\2|g' "{}" ";"
|
||||
shell: bash
|
||||
- name: Stop containers
|
||||
run: docker-compose -f "${{ github.action_path }}/docker-compose.yml" down
|
||||
shell: bash
|
||||
|
||||
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "3"
|
||||
services:
|
||||
kroki:
|
||||
image: yuzutech/kroki
|
||||
depends_on:
|
||||
- excalidraw
|
||||
environment:
|
||||
- KROKI_EXCALIDRAW_HOST=excalidraw
|
||||
ports:
|
||||
- "8080:8000"
|
||||
excalidraw:
|
||||
image: yuzutech/kroki-excalidraw
|
||||
expose:
|
||||
- "8004"
|
3
to_svg.sh
Executable file
3
to_svg.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
EXCALIDRAW=$(jq '{"type": .type, "version": .version, "source": .source, "elements": .elements, "appState": {"gridSize": null, "exportWithDarkMode": $2}}' "$1")
|
||||
curl localhost:8080/excalidraw/svg --data-raw "$EXCALIDRAW" > "$1.svg"
|
Loading…
Reference in New Issue
Block a user