Skip to content

Commit

Permalink
install custom google font support
Browse files Browse the repository at this point in the history
Update plantuml.yml

Update plantuml.yml

add unzip and test font in diagram

add generated diagrams

Update README.md

check if using default commit / push resolve issue of not re-triggered jobs

let's had back the checkout?

restore

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

test using gunzip

Update Dockerfile

fix google download url

Update entrypoint.sh

test download script

Update entrypoint.sh

test with Noto Font

add generated diagrams

test changes

add generated diagrams

add generated diagrams

Update backlog-item.puml

Update entrypoint.sh

test

Delete backlog-item.png

add generated diagrams
  • Loading branch information
chicco785 committed Apr 12, 2024
1 parent add88b9 commit e6098a9
Show file tree
Hide file tree
Showing 8 changed files with 520 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/plantuml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: generate and commit diagrams
uses: abekoh/commit-plantuml-action@1.0.3
uses: zaphiro-technologies/commit-plantuml-action@install-google-fonts
with:
botEmail: ${{ secrets.BOT_EMAIL }}
botGithubToken: ${{ secrets.GITHUB_TOKEN }}
enableReviewComment: true
installGoogleFont: Barlow:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ RUN apt-get install -y fonts-ipafont graphviz wget openjdk-8-jre git curl
RUN wget -P / --content-disposition https://sourceforge.net/projects/plantuml/files/plantuml.jar/download

COPY entrypoint.sh /entrypoint.sh
COPY google-font-download /google-font-download

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
botEmail: ${{ secrets.BOT_EMAIL }}
botGithubToken: ${{ secrets.GITHUB_TOKEN }}
enableReviewComment: true
installGoogleFont: Barlow
```

You must set `actions/checkout` before this step, to get source codes.
Expand All @@ -41,3 +42,11 @@ To add review comment. Use default [`secrets.GITHUB_TOKEN`](https://docs.github.
required: false, default: false

If set `true`, diff png files' information are submitted to pull request.

### installGoogleFont

required: false

If set, the value will be use to download and install a font family from
[google](https://fonts.google.com/). To be used in combination with `skinparam
defaultFontName` and other FontName skin settings for plantuml.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ inputs:
enableReviewComment:
description: "whether post review comment or not"
required: false
default: false
default: "false"
installGoogleFont:
description: "Google Font family to be installed"
required: false
runs:
using: "docker"
image: "Dockerfile"
20 changes: 16 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ if [[ "${INPUT_ENABLEREVIEWCOMMENT}" = "true" && ! "${INPUT_BOTGITHUBTOKEN}" ]];
echo "ERROR: Please set inputs.botGithubToken"
exit 1
fi
if [ -z "$INPUT_INSTALLGOOGLEFONT" ]; then
echo "No font family defined"
else
echo "Installing $INPUT_INSTALLGOOGLEFONT"
./google-font-download -f ttf --url="https://fonts.google.com/?selection.family=$INPUT_INSTALLGOOGLEFONT"
mkdir /usr/share/fonts/googlefonts
mv *.ttf /usr/share/fonts/googlefonts
rm *.css
fc-cache -fv
fi

# generate
git config --global --add safe.directory ${GITHUB_WORKSPACE}
Expand All @@ -26,22 +36,23 @@ done

# commit
if [[ ! $(git status --porcelain) ]]; then
echo "No changes to commit"
exit 0
fi
git config user.name "${GITHUB_ACTOR}"
git config user.email "${INPUT_BOTEMAIL}"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${INPUT_BOTEMAIL}"
git checkout ${GITHUB_HEAD_REF}
git add .
git commit -m "add generated diagrams"
git push origin HEAD:${GITHUB_HEAD_REF}
echo "comitted png files"

# add review comment
if [[ "${INPUT_ENABLEREVIEWCOMMENT}" != "true" ]]; then
git push
exit 0
fi
git fetch
GITHUB_SHA_AFTER=$(git rev-parse origin/${GITHUB_HEAD_REF})
GITHUB_SHA_AFTER=$(git rev-parse HEAD)
DIFF_FILES=`git diff ${GITHUB_SHA} ${GITHUB_SHA_AFTER} --name-only | grep ".png"`
echo $DIFF_FILES
BODY="## Diagrams changed\n"
Expand Down Expand Up @@ -71,3 +82,4 @@ curl -X POST \
-d "{\"event\": \"COMMENT\", \"body\": \"${BODY}\"}" \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUM}/reviews"
echo "added review comments"
git push
Loading

0 comments on commit e6098a9

Please sign in to comment.