From 9518372418551bec0008fc1daab30749d211a52c Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Tue, 17 Oct 2023 02:07:38 +0000 Subject: [PATCH] add svgs to assets/autogen --- action.yml | 2 +- to_svg.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index c50b487..8a14899 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,7 @@ runs: run: find "${{ github.workspace }}" -type f -name '*.excalidraw' -exec bash "${{ github.action_path }}/to_svg.sh" "{}" ${{ inputs.dark-mode == 'true' }} ";" shell: bash - name: Replace excalidraw file references - run: find "${{ github.workspace }}" -type f -name '*.md' -exec sed -ri 's|\[\[(.*\.excalidraw)\]\]|![\1](\1.svg)|g' "{}" ";" + run: find "${{ github.workspace }}" -type f -name '*.md' -exec sed -ri 's|\[\[(.*\.excalidraw)\]\]|![\1](assets/autogen/\1.svg)|g' "{}" ";" shell: bash - name: Stop containers run: docker-compose -f "${{ github.action_path }}/docker-compose.yml" down diff --git a/to_svg.sh b/to_svg.sh index cbfee2a..b8472f5 100755 --- a/to_svg.sh +++ b/to_svg.sh @@ -3,4 +3,5 @@ EXCALIDRAW="$(jq '{"type": .type, "version": .version, "source": .source, "eleme ENCODED="$(echo $EXCALIDRAW | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))")" echo ::debug::'$ENCODED' "$ENCODED" docker ps -curl "localhost:8080/excalidraw/svg/$ENCODED" > "$1.svg" +mkdir -p "assets/autogen/$(dirname $1)" +curl "localhost:8080/excalidraw/svg/$ENCODED" > "assets/autogen/$1.svg"