Final touches

This commit is contained in:
Lu Baumann 2023-10-18 13:56:58 +00:00 committed by GitHub
parent b106de1ab8
commit 81464eb582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 14 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
.idea

View File

@ -1,2 +1,33 @@
# logseq-publish-excalidraw-to-svg # logseq-publish-excalidraw-to-svg
Excalidraw drawings are not rendered when published in logseq. This action makes sure that they are converted to svg and inserts the svgs Excalidraw drawings are not rendered when published in logseq. This action makes sure that they are converted to svg and inserts the svgs
## Example action:
```yaml
on: [push]
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
name: Publish Logseq graph
steps:
- uses: actions/checkout@v3
- uses: Surferlul/logseq-publish-excalidraw-to-svg@main
with:
dark-mode: true
asset-repo: <YOUR USERNAME>/<YOUR REPOSITORY>
asset-repo-branch: <YOUR REPOSITORY BRANCH FOR AUTOGENERATED ASSETS>
asset-repo-token: "${{ secrets.<YOUR REPOSITORY ACCESS TOKEN WITH CONTENT READ/WRITE> }}"
- uses: logseq/publish-spa@main
with:
version: nightly
theme-mode: dark
- name: add a nojekyll file # to make sure asset paths are correctly identified
run: touch $GITHUB_WORKSPACE/www/.nojekyll
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: www
```

View File

@ -7,7 +7,7 @@ inputs:
default: 'false' default: 'false'
asset-repo: asset-repo:
description: Repository to store svg assets in description: Repository to store svg assets in
required: ture required: true
asset-repo-branch: asset-repo-branch:
description: The branch to store the svg assets in description: The branch to store the svg assets in
required: true required: true
@ -34,22 +34,11 @@ runs:
- name: Creating SVG files - name: Creating SVG files
run: (cd "${{ github.workspace }}" && find . -type f -name '*.excalidraw' -exec bash "${{ github.action_path }}/to_svg.sh" "{}" ${{ inputs.dark-mode == 'true' }} ";") run: (cd "${{ github.workspace }}" && find . -type f -name '*.excalidraw' -exec bash "${{ github.action_path }}/to_svg.sh" "{}" ${{ inputs.dark-mode == 'true' }} ";")
shell: bash shell: bash
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. - uses: EndBug/add-and-commit@v9
with: with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
add: 'svg-assets' 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 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 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' cwd: 'svg-repo'
- name: Replace excalidraw file references - name: Replace excalidraw file references
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' "{}" ";" 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' "{}" ";"