2023-10-10 01:58:30 +00:00
|
|
|
name: Logseq Excalidraw to SVG
|
2023-10-10 02:09:37 +00:00
|
|
|
description: Converts excalidraw to svg references
|
2023-10-13 17:03:04 +00:00
|
|
|
inputs:
|
2023-10-13 21:12:11 +00:00
|
|
|
dark-mode:
|
|
|
|
description: If drawings should be exported in dark mode
|
|
|
|
required: false
|
|
|
|
default: 'false'
|
2023-10-18 13:20:51 +00:00
|
|
|
asset-repo:
|
|
|
|
description: Repository to store svg assets in
|
|
|
|
required: ture
|
|
|
|
asset-repo-branch:
|
|
|
|
description: The branch to store the svg assets in
|
|
|
|
required: true
|
2023-10-10 02:09:37 +00:00
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
2023-10-18 13:20:51 +00:00
|
|
|
- name: Check out logseq-tenset-theme repo
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-10-18 13:27:03 +00:00
|
|
|
repository: "${{ inputs.asset-repo }}
|
|
|
|
ref: "${{ inputs.asset-repo-branch }}"
|
2023-10-18 13:20:51 +00:00
|
|
|
path: svg-repo
|
|
|
|
- run: mkdir -p svg-repo/svg-assets
|
2023-10-18 13:24:09 +00:00
|
|
|
shell: bash
|
2023-10-13 21:12:11 +00:00
|
|
|
- name: Start containers
|
|
|
|
run: docker-compose -f "${{ github.action_path }}/docker-compose.yml" up -d --build
|
|
|
|
shell: bash
|
2023-10-17 01:47:14 +00:00
|
|
|
- run: bash "${{ github.action_path }}/wait_for_kroki.sh"
|
2023-10-17 01:44:10 +00:00
|
|
|
shell: bash
|
2023-10-13 21:12:11 +00:00
|
|
|
- name: Creating SVG files
|
2023-10-17 10:22:35 +00:00
|
|
|
run: (cd "${{ github.workspace }}" && find . -type f -name '*.excalidraw' -exec bash "${{ github.action_path }}/to_svg.sh" "{}" ${{ inputs.dark-mode == 'true' }} ";")
|
2023-10-13 21:12:11 +00:00
|
|
|
shell: bash
|
2023-10-18 13:20:51 +00:00
|
|
|
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
|
|
|
|
with:
|
|
|
|
# The arguments for the `git add` command (see the paragraph below for more info)
|
|
|
|
# Default: '.'
|
|
|
|
add: 'svg-assets'
|
|
|
|
|
|
|
|
# The name of the user that will be displayed as the author of the commit.
|
|
|
|
# Default: depends on the default_author input
|
|
|
|
author_name: logseq-publish-excalidraw-to-svg
|
|
|
|
|
|
|
|
# The email of the user that will be displayed as the author of the commit.
|
|
|
|
# Default: depends on the default_author input
|
|
|
|
author_email: mail@lu-dev.de
|
|
|
|
|
|
|
|
# The local path to the directory where your repository is located. You should use actions/checkout first to set it up.
|
|
|
|
# Default: '.'
|
|
|
|
cwd: 'svg-repo'
|
2023-10-13 21:12:11 +00:00
|
|
|
- name: Replace excalidraw file references
|
2023-10-18 13:20:51 +00:00
|
|
|
run: find "${{ github.workspace }}" -type f -name '*.md' -exec sed -ri 's|\[\[(.*\.excalidraw)\]\]|![\1](https://raw.githubusercontent.com/${{ inputs.asset-repo }}/${{ inputs.asset-repo-branch }}/svg-assets/\1.svg)|g' "{}" ";"
|
2023-10-13 21:12:11 +00:00
|
|
|
shell: bash
|
|
|
|
- name: Stop containers
|
|
|
|
run: docker-compose -f "${{ github.action_path }}/docker-compose.yml" down
|
2023-10-10 02:09:37 +00:00
|
|
|
shell: bash
|
2023-10-10 01:51:11 +00:00
|
|
|
|