diff --git a/.github/scripts/prepare_publication.sh b/.github/scripts/prepare_publication.sh new file mode 100644 index 0000000..1544593 --- /dev/null +++ b/.github/scripts/prepare_publication.sh @@ -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)
" + done + line="$line|" + cd .. + echo "$line" >> ./list_versions.md +done + +echo "Local docs update finished." + + + diff --git a/.github/workflows/publish-diagrams.yml b/.github/workflows/publish-diagrams.yml new file mode 100644 index 0000000..d170bb1 --- /dev/null +++ b/.github/workflows/publish-diagrams.yml @@ -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