From 6c25a67a10ab5d19e40be80bcd3a7c35fbd627c1 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 17:08:40 +0700 Subject: [PATCH] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 82 ++++++++++++--------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 3fe6f0b8b0..f3d8218880 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -17,46 +17,46 @@ jobs: prepare-document: runs-on: portal-01 steps: - - name: test summary - run: echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY + # - name: test summary + # run: echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY - # - uses: actions/checkout@v4 - # - name: Set up Java - # uses: actions/setup-java@v4 - # with: - # distribution: 'temurin' - # java-version: '21' + - 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: 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) - # 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: Get current version + id: get_version + 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: 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: 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: 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: Run substitute + shell: bash + run: chmod +x Documentation/portal-guide/substitute.sh && Documentation/portal-guide/substitute.sh ${{ inputs.ivyVersion }} # - name: Build Documentation HTML # run: | @@ -84,3 +84,17 @@ jobs: # - name: Cleanup # shell: bash # run: rm -rf ${{ github.workspace }}/* + + test-deploy: + runs-on: portal-01 + container: + image: axonivy/build-container:read-the-docs-2 + env: + NODE_ENV: development + volumes: + - ${{ github.workspace }}:/workspace + options: --rm -w /workspace/Documentation/portal-guide + steps: + - name: Check for dockerenv file + run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv) + \ No newline at end of file