Build and Deploy Documentation π #27
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: Portal Documentation | |
run-name: Build and Deploy Documentation π | |
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/designer-guide/configuration/variables.html' | |
default: 'nightly' | |
required: true | |
push: | |
branches: | |
- 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' | |
jobs: | |
prepare-document: | |
runs-on: portal-01 | |
outputs: | |
documentVersion: ${{ steps.get_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.8 | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ vars.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get current version | |
id: get_version | |
run: | | |
VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout -f Documentation/pom.xml) | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
if [[ "$VERSION" == "null object or invalid expression" ]]; then | |
echo "Error: could not evaluate maven revision property" | |
exit 1 | |
fi | |
echo "Version is $VERSION" && echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Unzip portal screenshots | |
run: | | |
unzip /mnt/portal02/document-screenshots/portal-document-screenshots-selenide-${{ steps.get_version.outputs.version }}.zip \ | |
-d Documentation/portal-guide/source/screenshots | |
- name: Generate resources | |
run: | | |
mvn clean process-resources -Divy.engine.version=[13.1.0,] -Divy.engine.download.url=https://developer.axonivy.com/permalink/dev/axonivy-engine.zip -f Documentation/public-api/pom.xml | |
mvn clean generate-resources -f Documentation/pom.xml | |
- name: Run substitute | |
shell: bash | |
run: chmod +x Documentation/portal-guide/substitute.sh && Documentation/portal-guide/substitute.sh ${{ inputs.ivyVersion }} | |
- name: Build Documentation HTML | |
run: | | |
docker run -u root:root --rm -v ${{ github.workspace }}:/workspace -w /workspace/Documentation/portal-guide \ | |
axonivy/build-container:read-the-docs-2 make -C /doc-build html BASEDIR='/workspace/Documentation/portal-guide' VERSION=${{ steps.get_version.outputs.version }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: | | |
Documentation/*/build/html/**/* | |
Documentation/*/target/*.zip | |
- name: Cleanup | |
shell: bash | |
run: rm -r --force ${{ github.workspace }}\* |