Skip to content

Commit

Permalink
Fix Github documentation update action
Browse files Browse the repository at this point in the history
  • Loading branch information
phavekes committed Jan 16, 2024
1 parent 673b6f9 commit 5dea684
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ jobs:
- name: lint yaml files
uses: ibiqlik/action-yamllint@v2

- name: Install extra packages
run: apt-get update && apt-get install -y git zstd


# Check for changes in the server component of the Archimate model
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
archi:
- 'docs/invite.archimate'
server:
- 'server/src/**'
# - uses: dorny/paths-filter@v2

Check warning on line 39 in .github/workflows/doc.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

39:1 [comments-indentation] comment not indented like content
# id: changes
# with:
# filters: |
# archi:
# - 'docs/invite.archimate'
# server:
# - 'server/src/**'

# Generate the OpenApi spec json, only if the server component has changes
- name: Set up JDK 17
Expand All @@ -48,13 +52,14 @@ jobs:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'

Check warning on line 55 in .github/workflows/doc.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

55:1 [comments-indentation] comment not indented like content

- name: Set up MySQL
uses: shogo82148/actions-setup-mysql@v1
#uses: shogo82148/actions-setup-mysql@v1

Check warning on line 58 in .github/workflows/doc.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

58:10 [comments] missing starting space in comment
uses: mirromutth/[email protected]
with:
mysql-version: '8.0'
if: steps.changes.outputs.server == 'true'
mysql version: '8.0'
# if: steps.changes.outputs.server == 'true'
- name: Prepare database
run: |
mysql -uroot -h127.0.0.1 -e \
Expand All @@ -64,35 +69,35 @@ jobs:
"CREATE USER 'access'@'localhost' IDENTIFIED BY 'secret';";
mysql -uroot -h127.0.0.1 -e \
"GRANT ALL privileges ON access.* TO 'access'@'localhost';"
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'

- name: Generate openapi.json
run: |
cd server
mvn spring-boot:run &
sleep 20 && curl -q http://localhost:8888/ui/api-docs -o ./target/openapi.json
pkill -f java
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'

- name: Test api-specs with redoc-cli
uses: seeebiii/redoc-cli-github-action@v10
with:
args: 'bundle server/target/openapi.json -t template.hbs -o docs/api/index.html'
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'

- name: check result
run: |
ls -al docs/api/
test -f docs/api/index.html || (echo "Missing docs/api/index.html from previous step." && exit 1)
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'

- name: Commit files if the OpenAPI html has changed
run: |
git config user.name github-actions
git config user.email [email protected]
git add docs/api/index.html
git diff-index --quiet HEAD || git commit -m "Update github page"
if: steps.changes.outputs.server == 'true'
# if: steps.changes.outputs.server == 'true'
continue-on-error: true

# Generate a HTML page for the archmate model, only if the moder has changed
Expand All @@ -101,13 +106,13 @@ jobs:
curl "https://www.archimatetool.com/downloads/archi5.php?/5.1.0/Archi-Linux64-5.1.0.tgz" \
-q -o /tmp/archi.tgz
tar -zxvf /tmp/archi.tgz -C /tmp/
if: steps.changes.outputs.archi == 'true'
# if: steps.changes.outputs.archi == 'true'
- name: Generate HTML report from Archimate model
run: |
xvfb-run /tmp/Archi/Archi -application com.archimatetool.commandline.app \
-nosplash --consoleLog --loadModel ./docs/invite.archimate \
--html.createReport "./docs/Archi/"
if: steps.changes.outputs.archi == 'true'
# if: steps.changes.outputs.archi == 'true'

- name: Commit files if the Archimate html has changed
run: |
Expand All @@ -116,7 +121,7 @@ jobs:
git pull
git add docs/Archi/*
git diff-index --quiet HEAD || git commit -m "Update HTML export of Archimate file"
if: steps.changes.outputs.archi == 'true'
# if: steps.changes.outputs.archi == 'true'
continue-on-error: true

- name: Push changes
Expand Down

0 comments on commit 5dea684

Please sign in to comment.