Skip to content

πŸ“š Portal Documentation on branch feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation-10 #59

πŸ“š Portal Documentation on branch feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation-10

πŸ“š Portal Documentation on branch feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation-10 #59

name: Portal Documentation
run-name: πŸ“š Portal Documentation on branch ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
ivyVersion:
description: 'Ivy version use to replace |version| placeholder of the links which navigate to ivy documentation. e.g.: https://developer.axonivy.com/doc/nightly-10.0/designer-guide/configuration/variables.html'
default: 'nightly-10.0'
required: true
push:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
checkout-source:
runs-on: portal01
steps:
- uses: actions/checkout@v4
with:
ref: release/10.0
fetch-depth: 0
generate-resources:
needs: [checkout-source]
runs-on: portal01
outputs:
version: ${{ steps.get_version.outputs.version }}
container:
image: maven:3.8.6-eclipse-temurin-17
volumes:
- ${{ github.workspace }}
steps:
- name: Get current version
id: get_version
shell: bash
run: |
VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout -f Documentation/pom.xml)
if [[ "$VERSION" == "null object or invalid expression" ]]; then
echo "Error: could not evaluate maven revision property"
# Stops the workflow if the condition is met
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Version is $VERSION"
- name: Generate resources
run: |
mvn clean process-resources "-Divy.engine.version=[10.0.1,10.1.0)" "-Divy.engine.download.url=https://developer.axonivy.com/permalink/nightly-10.0/axonivy-engine.zip" -f Documentation/public-api/pom.xml
mvn clean generate-resources -f Documentation/pom.xml
unzip-screenshots:
needs: [generate-resources]
runs-on: portal01
steps:
- name: Unzip portal screenshots
run: |
unzip -o /mnt/portal02/document-screenshots/portal-document-screenshots-${{ needs.generate-resources.outputs.version }}.zip \
-d Documentation/portal-guide/source/screenshots
- name: Run substitute
shell: bash
run: chmod +x Documentation/portal-guide/substitute.sh && Documentation/portal-guide/substitute.sh ${{ inputs.ivyVersion }}
build-document:
needs: [generate-resources]
runs-on: portal01
container:
image: axonivy/build-container:read-the-docs-2
options: -u root:root
volumes:
- ${{ github.workspace }}:/workspace
steps:
- name: Build Documentation HTML
run: |
make -C /doc-build html BASEDIR='/workspace/Documentation/portal-guide' VERSION=-${{ needs.generate-resources.outputs.version }} 2> sphinx-warnings.log
WARNINGS=$(grep -c "WARNING" sphinx-warnings.log || echo 0)
echo "Found $WARNINGS warnings."
if [ "$WARNINGS" -ge 1 ]; then
echo "Documentation build has warnings. Adding to summary..."
echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY
echo "Found $WARNINGS warnings during the documentation build." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "#### Warning Details" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat sphinx-warnings.log >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit 1
fi
install-or-deploy:
needs: [generate-resources,build-document]
runs-on: portal01
steps:
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
server-id: 'nexus.axonivy.com'
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Install or deploy document
shell: bash
run: |
if [[ "${{ needs.generate-resources.outputs.version }}" == *SNAPSHOT* ]]; then
PHASE="install"
else
PHASE="deploy"
fi
echo "Running 'clean $PHASE' for version ${{ needs.generate-resources.outputs.version }}"
mvn clean $PHASE -f Documentation/pom.xml
env:
MAVEN_USERNAME: ${{ secrets.NEXUS_AXONIVY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_AXONIVY_PASSWORD }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Documentation
path: |
Documentation/*/target/*.zip
clean-up:
runs-on: portal01
needs: [install-or-deploy]
if: always()
steps:
- name: Clean up
shell: bash
run: sudo rm -rf ${{ github.workspace }}/*