Skip to content

Commit

Permalink
docs: add automated publishing of diagrams to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanpierrefortune committed Nov 29, 2023
1 parent 1bab39e commit 6afcf41
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/scripts/prepare_publication.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

repository_name=$(git rev-parse --show-toplevel | xargs basename)

echo "Clone $repository_name..."
git clone https://github.com/calypsonet/$repository_name.git

cd "$repository_name" || exit

echo "Repository name: $repository_name"

echo "Checkout gh-pages branch..."
git checkout -f gh-pages

echo "Delete existing SNAPSHOT directory..."
rm -rf *-SNAPSHOT

echo "Copy diagram folders..."
find .. -type d -regex '\.\./[0-9].*$' -exec cp -rf -t . {} +

echo "Update versions list..."
echo "| Version | Documents |" > list_versions.md
echo "|:---:|---|" >> list_versions.md
for directory in $(ls -rd [0-9]*/ | cut -f1 -d'/')
do
line="| $directory |"
cd "$directory" || exit
for file in $(ls -r *.svg | cut -f1 -d'/')
do
line="$line[$file]($directory/$file)<br/>"
done
line="$line|"
cd ..
echo "$line" >> ./list_versions.md
done

echo "Local docs update finished."



30 changes: 30 additions & 0 deletions .github/workflows/publish-diagrams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Calypsonet Terminal Calypso Crypto Legacy SAM Java API - UML class diagrams to GH pages

on:
push:
branches:
- main

jobs:
publish-diagrams:
runs-on: ubuntu-latest
steps:
- name: Check out repository code from ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Update permissions
working-directory: .
run: chmod +x ./.github/scripts/*.sh
- name: Prepare publication locally
working-directory: .
run: ./.github/scripts/prepare_publication.sh
- name: Deploy diagrams to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./${{ github.event.repository.name }}
enable_jekyll: true

0 comments on commit 6afcf41

Please sign in to comment.