Skip to content

Build and Deploy Documentation πŸš€ #20

Build and Deploy Documentation πŸš€

Build and Deploy Documentation πŸš€ #20

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: 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 HTML documentation
# uses: docker://axonivy/build-container:read-the-docs-2
# with:
# args: make -C /doc-build html BASEDIR=${{ github.workspace }}/Documentation/portal-guide VERSION=${{ steps.get_version.outputs.version }}
- name: Build Documentation HTML
run: |
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/Documentation/portal-guide \
$DOCKER_IMAGE_AXONIVY make 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
# build-document:
# runs-on: portal-01
# needs: prepare-document
# steps:
# - name: Build HTML documentation with Read the Docs
# container:
# image: axonivy/build-container:read-the-docs-2
# env:
# BASEDIR: ${{ github.workspace }}/Documentation/portal-guide
# VERSION: ${{ needs.prepare-document.outputs.documentVersion }}
# run: make -C /doc-build html
# uses: docker://axonivy/build-container:read-the-docs-2
# with:
# entrypoint: "make"
# env:
# BASEDIR: ${{ github.workspace }}/Documentation/portal-guide
# VERSION: ${{ needs.prepare-document.outputs.documentVersion }}
# args: ["-C", "/doc-build", "html"]
# - name: Cleanup
# shell: bash
# run: |
# rm -r --force ${{ github.workspace }}\*
# unzip-screenshot:
# runs-on: portal-01
# needs: get-current-version
# steps:
# - name: Unzip portal screenshots
# run: |
# unzip /mnt/portal02/document-screenshots/portal-document-screenshots-selenide-${{ needs.get-current-version.outputs.documentVersion }}.zip \
# -d Documentation/portal-guide/source/screenshots
# test-another-job:
# runs-on: portal-01
# needs: get-current-version
# container:
# image: axonivy/build-container:read-the-docs-2
# steps:
# - name: test-1
# run: echo ${{ needs.get-current-version.outputs.documentVersion }}
# - run: echo "πŸŽ‰ The job was manually triggered by a ${{ inputs.ivyVersion }} event."
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# - run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# - name: Check out repository code
# uses: actions/checkout@v4
# - run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
# - run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
# - name: List files in the repository
# run: |
# ls ${{ github.workspace }}
# - run: echo "🍏 This job's status is ${{ job.status }}."