fix: ci #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate SVG from DOT and commit | |
# Temporaneamente disattivata | |
#on: | |
# push: | |
# paths: | |
# - 'docs/diagramma-er.dot' | |
jobs: | |
generate-svg: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Check if SVG file is modified | |
id: svg-changed | |
run: | | |
SVG_CHANGED=$(git diff --name-only HEAD^ HEAD | grep 'docs/diagramma-er-gv.svg' || true) | |
echo "SVG_CHANGED=${SVG_CHANGED}" >> $GITHUB_ENV | |
- name: Exit if SVG not changed | |
run: exit 0 | |
if: env.SVG_CHANGED == '' | |
- name: Configure Git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Cache Graphviz installation | |
id: cache-graphviz | |
uses: actions/cache@v3 | |
with: | |
path: /var/cache/apt/archives | |
key: graphviz-${{ runner.os }}-${{ hashFiles('**/apt-get.lock') }} | |
restore-keys: | | |
graphviz-${{ runner.os }}- | |
- name: Install Graphviz | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt -f install | |
sudo apt install -y graphviz | |
- name: Generate SVG from DOT | |
run: dot -Tsvg docs/diagramma-er.dot -o docs/diagramma-er-gv.svg | |
- name: Commit and push changes | |
run: | | |
git add docs/diagramma-er-gv.svg | |
git commit -m "Generate SVG from DOT" | |
git push origin |