From 8386106b66b57a5b89fd84013df383e4d94fcf7d Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Mon, 23 Dec 2024 14:48:18 +0700 Subject: [PATCH 01/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation - init doc workflow --- .github/workflows/portal-documentation.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/portal-documentation.yaml diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml new file mode 100644 index 0000000000..15a61d6b6d --- /dev/null +++ b/.github/workflows/portal-documentation.yaml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} 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 }}." From 776ab55a9cd09a97c5f1efedd35d9863fb49519d Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Mon, 23 Dec 2024 15:02:53 +0700 Subject: [PATCH 02/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation - update --- .github/workflows/portal-documentation.yaml | 38 +++++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 15a61d6b6d..92fa51cd60 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,18 +1,26 @@ -name: GitHub Actions Demo -run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 -on: [push] +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' + required: true + default: 'nightly' + type: string + jobs: Explore-GitHub-Actions: - runs-on: ubuntu-latest + runs-on: portal01 steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} 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 }}." + - 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 }}." From 24ec03260c72f29a6252931b20829235189221ec Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Mon, 23 Dec 2024 15:07:13 +0700 Subject: [PATCH 03/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 92fa51cd60..3ca675ab03 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,6 +1,7 @@ name: Portal Documentation run-name: Build and Deploy Documentation 🚀 -on: +on: + push: workflow_dispatch: inputs: ivyVersion: From dcc09a500fe48cb2fbc70ef2a060f7b8338c9518 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Mon, 23 Dec 2024 15:12:51 +0700 Subject: [PATCH 04/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 3ca675ab03..b9c9eab8c1 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -11,8 +11,8 @@ on: type: string jobs: - Explore-GitHub-Actions: - runs-on: portal01 + test-ne: + runs-on: portal-01 steps: - 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!" From 0a41a099043878a267a35486b1db81b16a5e9de2 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Mon, 23 Dec 2024 17:45:06 +0700 Subject: [PATCH 05/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation - test version --- .github/workflows/portal-documentation.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index b9c9eab8c1..0a05791646 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -14,7 +14,23 @@ jobs: test-ne: runs-on: portal-01 steps: - - run: echo "🎉 The job was manually triggered by a ${{ inputs.ivyVersion }} event." + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set build description + run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins + + - 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" + # - 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 From 75be785aa069cf3d292cefd2a0b582a1765f69c1 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 10:41:32 +0700 Subject: [PATCH 06/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 22 ++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 0a05791646..ca6ca777ab 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -19,9 +19,13 @@ jobs: - name: Set build description run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins - - - name: Get current version - id: get_version + + get-current-version: + runs-on: portal-01 + container: + image: maven:3.9.8-eclipse-temurin-21 + steps: + - name: Check for dockerenv file run: | VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout -f Documentation/pom.xml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" @@ -30,6 +34,18 @@ jobs: exit 1 fi echo "Version is $VERSION" + + # - name: Get current version + # uses: docker://maven:3.9.8-eclipse-temurin-21 + # 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" # - 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 }}." From 19c9dee446fa89fabcae8a039f1311f33d77781a Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 11:32:36 +0700 Subject: [PATCH 07/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 36 ++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index ca6ca777ab..9454064e67 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -24,8 +24,14 @@ jobs: runs-on: portal-01 container: image: maven:3.9.8-eclipse-temurin-21 + outputs: + documentVersion: ${{ steps.get_version.outputs.version }} steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Check for dockerenv file + id: get_version run: | VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout -f Documentation/pom.xml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" @@ -33,19 +39,27 @@ jobs: echo "Error: could not evaluate maven revision property" exit 1 fi + ll echo "Version is $VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Unzip screenshots + run: echo ${{ steps.get_version.outputs.version }} + + test-another-job: + runs-on: portal-01 + needs: get-current-version + container: + image: axonivy/build-container:read-the-docs-2 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: test-1 + run: echo ${{ needs.get-current-version.outputs.documentVersion }} + + - # - name: Get current version - # uses: docker://maven:3.9.8-eclipse-temurin-21 - # 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" # - 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 }}." From 2cc6a584107acd2b5e439cbc22ea008095e68419 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 11:34:34 +0700 Subject: [PATCH 08/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 9454064e67..0b6eed840b 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -39,7 +39,6 @@ jobs: echo "Error: could not evaluate maven revision property" exit 1 fi - ll echo "Version is $VERSION" echo "version=$VERSION" >> "$GITHUB_OUTPUT" From 02536f609d517e5f15c3bff538f1b642b3d78be6 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 14:42:52 +0700 Subject: [PATCH 09/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 29 ++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 0b6eed840b..57177c7703 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -11,25 +11,22 @@ on: type: string jobs: - test-ne: - runs-on: portal-01 - steps: - - name: Checkout code - uses: actions/checkout@v4 + # test-ne: + # runs-on: portal-01 + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 - - name: Set build description - run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins + # - name: Set build description + # run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins get-current-version: runs-on: portal-01 container: - image: maven:3.9.8-eclipse-temurin-21 + image: maven:3.9.8-eclipse-temurin-21 outputs: documentVersion: ${{ steps.get_version.outputs.version }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Check for dockerenv file id: get_version run: | @@ -41,19 +38,21 @@ jobs: fi echo "Version is $VERSION" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - + - name: Unzip screenshots run: echo ${{ steps.get_version.outputs.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 + test-another-job: runs-on: portal-01 needs: get-current-version container: image: axonivy/build-container:read-the-docs-2 steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: test-1 run: echo ${{ needs.get-current-version.outputs.documentVersion }} From 6eb60cebcf02d432d319bafa492a296937ae7d7b Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 14:44:22 +0700 Subject: [PATCH 10/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 57177c7703..e8c45b453c 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -42,6 +42,9 @@ jobs: - name: Unzip screenshots run: echo ${{ steps.get_version.outputs.version }} + unzip-screenshot: + runs-on: portal-01 + steps: - name: Unzip portal screenshots run: | unzip /mnt/portal02/document-screenshots/portal-document-screenshots-selenide-${{ steps.get_version.outputs.version }}.zip \ From 4eba25645c4facdaa19494eb1b5520b5e433dc5e Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 14:45:43 +0700 Subject: [PATCH 11/45] update --- .github/workflows/portal-documentation.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index e8c45b453c..07fa6cf4eb 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -44,10 +44,11 @@ jobs: 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-${{ steps.get_version.outputs.version }}.zip \ + 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: From db8a649d59434998adc39acc30f2ec58e8b6533f Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 15:01:31 +0700 Subject: [PATCH 12/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 07fa6cf4eb..f07f2ea7f8 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -20,6 +20,19 @@ jobs: # - name: Set build description # run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins + test-phat: + runs-on: portal-01 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + # cache: 'maven' + # cache-dependency-path: 'sub-project/pom.xml' # optional + - name: Build with Maven + run: mvn --version + get-current-version: runs-on: portal-01 container: From f9191abd9a6cc2a65cc8cb227f246d027eed969f Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 15:03:54 +0700 Subject: [PATCH 13/45] update --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index f07f2ea7f8..fea71624e2 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -28,7 +28,7 @@ jobs: with: distribution: 'temurin' java-version: '21' - # cache: 'maven' + cache: 'maven' # cache-dependency-path: 'sub-project/pom.xml' # optional - name: Build with Maven run: mvn --version From 2c6a7040df657d3bc0d46a8876a8e377293722e4 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 15:07:00 +0700 Subject: [PATCH 14/45] update --- .github/workflows/portal-documentation.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index fea71624e2..7c556e7f29 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -23,13 +23,17 @@ jobs: test-phat: runs-on: portal-01 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - name: Set up Maven + uses: stCarolas/setup-maven@v5 with: - distribution: 'temurin' - java-version: '21' - cache: 'maven' - # cache-dependency-path: 'sub-project/pom.xml' # optional + maven-version: 3.9.8 + # - uses: actions/checkout@v4 + # - uses: actions/setup-java@v4 + # with: + # distribution: 'temurin' + # java-version: '21' + # cache: 'maven' + # # cache-dependency-path: 'sub-project/pom.xml' # optional - name: Build with Maven run: mvn --version From c6b6bedf8dca3b66e9f64f4e14817605ce34b93b Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 16:22:21 +0700 Subject: [PATCH 15/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 59 ++++++++++++++------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 7c556e7f29..5b9d54e16b 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -37,14 +37,22 @@ jobs: - name: Build with Maven run: mvn --version - get-current-version: + prepare-document: runs-on: portal-01 - container: - image: maven:3.9.8-eclipse-temurin-21 outputs: documentVersion: ${{ steps.get_version.outputs.version }} steps: - - name: Check for dockerenv file + - 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) @@ -58,24 +66,39 @@ jobs: - name: Unzip screenshots run: echo ${{ steps.get_version.outputs.version }} - - 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 \ + 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 + echo "helloooo" - 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 }} + # - 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 }} From 128ba240a9d5b14b7392c0e9ab29c9da0266895a Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 16:24:39 +0700 Subject: [PATCH 16/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 5b9d54e16b..35706214eb 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -73,7 +73,7 @@ jobs: -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 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 echo "helloooo" From 5c58313411f6a5dff92d7a651e9d1ec7d3231baf Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 16:37:32 +0700 Subject: [PATCH 17/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 35706214eb..fe1a11376f 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -2,13 +2,14 @@ name: Portal Documentation run-name: Build and Deploy Documentation 🚀 on: push: + # branches: + # - 'master' 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' - required: true default: 'nightly' - type: string + required: true jobs: # test-ne: @@ -61,21 +62,21 @@ jobs: echo "Error: could not evaluate maven revision property" exit 1 fi - echo "Version is $VERSION" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Unzip screenshots - run: echo ${{ steps.get_version.outputs.version }} + 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 - echo "helloooo" + + - name: Run substitute + shell: bash + run: chmod +x Documentation/portal-guide/substitute.sh && Documentation/portal-guide/substitute.sh ${{ inputs.ivyVersion }} # - name: Cleanup # shell: bash From 6bf108a3f6cfa59fb84ac406fca01c70892ac1c2 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 17:28:16 +0700 Subject: [PATCH 18/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 64 +++++++++++---------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index fe1a11376f..bf877a1ac9 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,43 +1,17 @@ name: Portal Documentation run-name: Build and Deploy Documentation 🚀 on: - push: - # branches: - # - 'master' 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: - # test-ne: - # runs-on: portal-01 - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 - - # - name: Set build description - # run: echo "Running on ${{ runner.name }}" # Similar to setting currentBuild.description in Jenkins - - test-phat: - runs-on: portal-01 - steps: - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.8 - # - uses: actions/checkout@v4 - # - uses: actions/setup-java@v4 - # with: - # distribution: 'temurin' - # java-version: '21' - # cache: 'maven' - # # cache-dependency-path: 'sub-project/pom.xml' # optional - - name: Build with Maven - run: mvn --version - prepare-document: runs-on: portal-01 outputs: @@ -78,6 +52,38 @@ jobs: 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: 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: | From 928c46140f7b238e92cb9f85fc746ebd9a11cbe4 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 17:32:07 +0700 Subject: [PATCH 19/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index bf877a1ac9..64ddd0300b 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -55,7 +55,7 @@ jobs: - 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 }} + args: make -C /doc-build html BASEDIR=${{ github.workspace }}/Documentation/portal-guide VERSION=${{ steps.get_version.outputs.version }} - name: Upload artifacts uses: actions/upload-artifact@v4 From b43e6b02854c6586e4a8fceb80f8f73b53929bc6 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 18:23:10 +0700 Subject: [PATCH 20/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 64ddd0300b..e79e0cfb63 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -52,10 +52,18 @@ jobs: 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 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 }}/Documentation/portal-guide:/doc-build/source \ + -w /doc-build \ + axonivy/build-container:read-the-docs-2 \ + make html VERSION=${{ steps.get_version.outputs.version }} - name: Upload artifacts uses: actions/upload-artifact@v4 From e3a71b8ddc15b9122f1f4b4809080adad4480217 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Tue, 24 Dec 2024 18:31:07 +0700 Subject: [PATCH 21/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index e79e0cfb63..b77acb8426 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -59,11 +59,8 @@ jobs: - name: Build Documentation HTML run: | - docker run --rm \ - -v ${{ github.workspace }}/Documentation/portal-guide:/doc-build/source \ - -w /doc-build \ - axonivy/build-container:read-the-docs-2 \ - make html VERSION=${{ steps.get_version.outputs.version }} + 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 From 57aeb680bdd7b7e52c3b4bdc5a05535e9a1a5c60 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 10:22:32 +0700 Subject: [PATCH 22/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index b77acb8426..a90e97d7b9 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -27,6 +27,13 @@ jobs: 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 }} + - name: Get current version id: get_version run: | From 1d543964c20ee0b6e0182c201ab4ce80b2efad73 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 10:44:03 +0700 Subject: [PATCH 23/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index a90e97d7b9..c64e243fa2 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -32,7 +32,7 @@ jobs: uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Get current version id: get_version From 665192c525bfb670627ea3bf8e32128db0dad715 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 10:46:31 +0700 Subject: [PATCH 24/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index c64e243fa2..bf77458192 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -67,7 +67,7 @@ jobs: - 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 }} + axonivy/build-container:read-the-docs-2 make html BASEDIR='/workspace/Documentation/portal-guide' VERSION=${{ steps.get_version.outputs.version }} - name: Upload artifacts uses: actions/upload-artifact@v4 From 220ba7f234f1576fb907c736c1b3e70d0c4b1730 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 11:00:07 +0700 Subject: [PATCH 25/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index bf77458192..5f702d0a11 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -67,7 +67,7 @@ jobs: - name: Build Documentation HTML run: | docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/Documentation/portal-guide \ - axonivy/build-container:read-the-docs-2 make html BASEDIR='/workspace/Documentation/portal-guide' VERSION=${{ steps.get_version.outputs.version }} + 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 From 1281423eb00f6bc7e5a904af576543d3220a6338 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 11:28:42 +0700 Subject: [PATCH 26/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 5f702d0a11..34e2e85839 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -66,7 +66,7 @@ jobs: - name: Build Documentation HTML run: | - docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/Documentation/portal-guide \ + 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 From e7d6562a7280b44c2c86da63476634eda3bab1bb Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 14:13:57 +0700 Subject: [PATCH 27/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 73 +++------------------ 1 file changed, 8 insertions(+), 65 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 34e2e85839..56c03315ac 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -28,11 +28,11 @@ jobs: 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: 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 @@ -59,11 +59,6 @@ jobs: 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 -u root:root --rm -v ${{ github.workspace }}:/workspace -w /workspace/Documentation/portal-guide \ @@ -76,59 +71,7 @@ jobs: 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 }}." + - name: Cleanup + shell: bash + run: rm -r --force ${{ github.workspace }}\* From 8071a152a484dce663db1f0c7a216ca8ba7eb6ab Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 14:46:46 +0700 Subject: [PATCH 28/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 24 ++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 56c03315ac..c1eb72f97a 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -14,8 +14,6 @@ on: jobs: prepare-document: runs-on: portal-01 - outputs: - documentVersion: ${{ steps.get_version.outputs.version }} steps: - uses: actions/checkout@v4 - name: Set up Java @@ -23,27 +21,23 @@ jobs: 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" + # Stops the workflow if the condition is met exit 1 fi - echo "Version is $VERSION" && echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Version is $VERSION" - name: Unzip portal screenshots run: | @@ -64,6 +58,16 @@ jobs: 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: Install or deploy document + run: | + if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + PHASE="install" + else + PHASE="deploy" + fi + echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + mvn clean $PHASE -f Documentation/pom.xml + - name: Upload artifacts uses: actions/upload-artifact@v4 with: From 79b0e43ee6f1284bbbc7c4e0eb9a90d80d0ccb8b Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 16:01:49 +0700 Subject: [PATCH 29/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 115 ++++++++++---------- 1 file changed, 60 insertions(+), 55 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index c1eb72f97a..3fe6f0b8b0 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,6 +1,8 @@ name: Portal Documentation run-name: Build and Deploy Documentation 🚀 on: + schedule: + - cron: '0 0 * * *' # Equivalent to '@midnight' workflow_dispatch: inputs: ivyVersion: @@ -15,67 +17,70 @@ jobs: prepare-document: runs-on: portal-01 steps: - - uses: actions/checkout@v4 - - name: Set up Java - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '21' + - name: test summary + run: echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.8 + # - uses: actions/checkout@v4 + # - name: Set up Java + # uses: actions/setup-java@v4 + # with: + # distribution: 'temurin' + # java-version: '21' - - 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: 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: 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: | - 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: 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: Install or deploy document - run: | - if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then - PHASE="install" - else - PHASE="deploy" - fi - echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" - mvn clean $PHASE -f Documentation/pom.xml + # - name: Install or deploy document + # run: | + # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + # PHASE="install" + # else + # PHASE="deploy" + # fi + # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + # mvn clean $PHASE -f Documentation/pom.xml - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: documentation - path: | - Documentation/*/build/html/**/* - Documentation/*/target/*.zip + # - 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 }}\* + # - name: Cleanup + # shell: bash + # run: rm -rf ${{ github.workspace }}/* From 6c25a67a10ab5d19e40be80bcd3a7c35fbd627c1 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Wed, 25 Dec 2024 17:08:40 +0700 Subject: [PATCH 30/45] 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 From acc29cbe5724daafced79fd69d695a4c83d9e663 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:21:41 +0700 Subject: [PATCH 31/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 150 ++++++++++++-------- 1 file changed, 87 insertions(+), 63 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index f3d8218880..f9571c2c5c 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -14,87 +14,111 @@ on: - 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' jobs: - prepare-document: - runs-on: portal-01 + build-screenshot: + runs-on: ubuntu-latest steps: - # - name: test summary - # run: echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY - - uses: actions/checkout@v4 + with: + ref: master + - 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) - 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: Extract Engine + run: docker ps + + shell: bash + + + # build-document: + # runs-on: portal-01 + # steps: + # # - 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' + + # - 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: 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: | - # 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: 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: Install or deploy document - # run: | - # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then - # PHASE="install" - # else - # PHASE="deploy" - # fi - # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" - # mvn clean $PHASE -f Documentation/pom.xml + # # - name: Install or deploy document + # # run: | + # # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + # # PHASE="install" + # # else + # # PHASE="deploy" + # # fi + # # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + # # mvn clean $PHASE -f Documentation/pom.xml - # - name: Upload artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: documentation - # path: | - # Documentation/*/build/html/**/* - # Documentation/*/target/*.zip + # # - name: Upload artifacts + # # uses: actions/upload-artifact@v4 + # # with: + # # name: documentation + # # path: | + # # Documentation/*/build/html/**/* + # # Documentation/*/target/*.zip - # - name: Cleanup - # shell: bash - # run: rm -rf ${{ github.workspace }}/* + # # - 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) + # 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 From d897c04f5c995c1b32456db28c9f106070960241 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:29:11 +0700 Subject: [PATCH 32/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index f9571c2c5c..6e18e2c97e 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -9,13 +9,23 @@ on: 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 + + modulesMustBeBuilt: + description: 'Modules that must be built (comma-separated)' + required: false + default: '' + push: branches: - 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' +env: + MAVEN_CACHE: /var/tools/maven-cache + jobs: build-screenshot: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 with: @@ -36,6 +46,32 @@ jobs: run: docker ps shell: bash + + - name: Build Docker image for building + run: docker build -t build-portal-modules -f build/Dockerfile . + + - name: Build Modules + id: build + run: | + MODULES=("AxonIvyPortal/portal-components" "AxonIvyPortal/portal" "AxonIvyPortal/PortalKitTestHelper" "Showcase/portal-user-examples" "Showcase/portal-developer-examples" "Showcase/InternalSupport" "Showcase/portal-components-examples") + BUILT_MODULES=() + + if [ "${{ github.event.before }}" != "" ]; then + CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) + else + CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD) + fi + + for MODULE in "${MODULES[@]}"; do + MODULE_NAME=$(basename $MODULE) + if [[ "$CHANGED_FILES" == *"$MODULE"* ]] || [[ "${{ inputs.modulesMustBeBuilt }}" == *"$MODULE_NAME"* ]]; then + docker run --rm build-portal-modules mvn clean install -f ${MODULE}/pom.xml + BUILT_MODULES+=("$MODULE") + fi + done + + echo "built_modules=${BUILT_MODULES[*]}" >> $GITHUB_OUTPUT + # build-document: From 955e5431b815860d3f5bb2b0bb98dafdbd52ec0e Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:32:12 +0700 Subject: [PATCH 33/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 6e18e2c97e..5ac7d47c3f 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -22,6 +22,9 @@ on: env: MAVEN_CACHE: /var/tools/maven-cache +permissions: + contents: write + jobs: build-screenshot: runs-on: ubuntu-latest From 7fe5d47a0462688b714b4536944156a0759342da Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:34:13 +0700 Subject: [PATCH 34/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 5ac7d47c3f..5616180f6d 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -59,18 +59,10 @@ jobs: MODULES=("AxonIvyPortal/portal-components" "AxonIvyPortal/portal" "AxonIvyPortal/PortalKitTestHelper" "Showcase/portal-user-examples" "Showcase/portal-developer-examples" "Showcase/InternalSupport" "Showcase/portal-components-examples") BUILT_MODULES=() - if [ "${{ github.event.before }}" != "" ]; then - CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) - else - CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD) - fi - for MODULE in "${MODULES[@]}"; do MODULE_NAME=$(basename $MODULE) - if [[ "$CHANGED_FILES" == *"$MODULE"* ]] || [[ "${{ inputs.modulesMustBeBuilt }}" == *"$MODULE_NAME"* ]]; then - docker run --rm build-portal-modules mvn clean install -f ${MODULE}/pom.xml - BUILT_MODULES+=("$MODULE") - fi + docker run --rm build-portal-modules mvn clean install -f ${MODULE}/pom.xml + BUILT_MODULES+=("$MODULE") done echo "built_modules=${BUILT_MODULES[*]}" >> $GITHUB_OUTPUT From e79cb437350ec3b53480d8b3b069a65e4f5e54f9 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:37:47 +0700 Subject: [PATCH 35/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 5616180f6d..7d97c34a90 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -50,18 +50,20 @@ jobs: shell: bash - - name: Build Docker image for building - run: docker build -t build-portal-modules -f build/Dockerfile . + # - name: Build Docker image for building + # run: docker build -t build-portal-modules -f build/Dockerfile . - name: Build Modules id: build run: | + addgroup --gid 1001 build && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" build + MODULES=("AxonIvyPortal/portal-components" "AxonIvyPortal/portal" "AxonIvyPortal/PortalKitTestHelper" "Showcase/portal-user-examples" "Showcase/portal-developer-examples" "Showcase/InternalSupport" "Showcase/portal-components-examples") BUILT_MODULES=() for MODULE in "${MODULES[@]}"; do MODULE_NAME=$(basename $MODULE) - docker run --rm build-portal-modules mvn clean install -f ${MODULE}/pom.xml + mvn clean install -f ${MODULE}/pom.xml BUILT_MODULES+=("$MODULE") done From 6f862a9016c1813aad852fd5f7b3b19f2c70b4f9 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 10:52:01 +0700 Subject: [PATCH 36/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 7d97c34a90..2126b2cfa3 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -60,14 +60,20 @@ jobs: MODULES=("AxonIvyPortal/portal-components" "AxonIvyPortal/portal" "AxonIvyPortal/PortalKitTestHelper" "Showcase/portal-user-examples" "Showcase/portal-developer-examples" "Showcase/InternalSupport" "Showcase/portal-components-examples") BUILT_MODULES=() - + + set +e # Allow the script to continue even if a build fails for MODULE in "${MODULES[@]}"; do - MODULE_NAME=$(basename $MODULE) - mvn clean install -f ${MODULE}/pom.xml - BUILT_MODULES+=("$MODULE") + if mvn clean install -f ${MODULE}/pom.xml; then + BUILT_MODULES+=("$MODULE") + else + echo "WARNING: Build failed for $MODULE" >&2 + fi done - - echo "built_modules=${BUILT_MODULES[*]}" >> $GITHUB_OUTPUT + set -e # Re-enable exit on error + + # Debug logs + echo "DEBUG: BUILT_MODULES = ${BUILT_MODULES[*]}" + echo "built_modules=${BUILT_MODULES[*]}" | tee -a $GITHUB_OUTPUT From 556058bf0b61e0c173d7d89eef223dec56d427e5 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:20:12 +0700 Subject: [PATCH 37/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 187 ++++++++------------ 1 file changed, 70 insertions(+), 117 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 2126b2cfa3..d41690eee6 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -26,138 +26,91 @@ permissions: contents: write jobs: - build-screenshot: - runs-on: ubuntu-latest - + + build-document: + runs-on: portal-01 steps: - - uses: actions/checkout@v4 - with: - ref: master + # - 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' - + - name: Set up Maven uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.8 - - name: Extract Engine - run: docker ps - - shell: bash - - # - name: Build Docker image for building - # run: docker build -t build-portal-modules -f build/Dockerfile . - - - name: Build Modules - id: build + - name: Get current version + id: get_version run: | - addgroup --gid 1001 build && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" build - - MODULES=("AxonIvyPortal/portal-components" "AxonIvyPortal/portal" "AxonIvyPortal/PortalKitTestHelper" "Showcase/portal-user-examples" "Showcase/portal-developer-examples" "Showcase/InternalSupport" "Showcase/portal-components-examples") - BUILT_MODULES=() - - set +e # Allow the script to continue even if a build fails - for MODULE in "${MODULES[@]}"; do - if mvn clean install -f ${MODULE}/pom.xml; then - BUILT_MODULES+=("$MODULE") - else - echo "WARNING: Build failed for $MODULE" >&2 - fi - done - set -e # Re-enable exit on error - - # Debug logs - echo "DEBUG: BUILT_MODULES = ${BUILT_MODULES[*]}" - echo "built_modules=${BUILT_MODULES[*]}" | tee -a $GITHUB_OUTPUT - - - - # build-document: - # runs-on: portal-01 - # steps: - # # - 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' - - # - 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" + 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: 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: Install or deploy document - # # run: | - # # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then - # # PHASE="install" - # # else - # # PHASE="deploy" - # # fi - # # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" - # # mvn clean $PHASE -f Documentation/pom.xml - - # # - name: Upload artifacts - # # uses: actions/upload-artifact@v4 - # # with: - # # name: documentation - # # path: | - # # Documentation/*/build/html/**/* - # # Documentation/*/target/*.zip - - # # - name: Cleanup - # # shell: bash - # # run: rm -rf ${{ github.workspace }}/* + - name: Run substitute + shell: bash + run: chmod +x Documentation/portal-guide/substitute.sh && Documentation/portal-guide/substitute.sh ${{ inputs.ivyVersion }} - # 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) + - 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 }} > sphinx-warnings.log || true + WARNINGS=$(grep -c "WARNING" sphinx-warnings.log || echo 0) + echo "locne" + echo "Found $WARNINGS warnings." + + # - name: Install or deploy document + # run: | + # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + # PHASE="install" + # else + # PHASE="deploy" + # fi + # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + # mvn clean $PHASE -f Documentation/pom.xml + + # - name: Upload artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: documentation + # path: | + # Documentation/*/build/html/**/* + # Documentation/*/target/*.zip + + - 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 From 026e41090586583f34b03205d5a9f1b26e8657d9 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:34:02 +0700 Subject: [PATCH 38/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 40 ++++++++++----------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index d41690eee6..0a19dbd806 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -57,27 +57,38 @@ jobs: 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: 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: | 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 }} > sphinx-warnings.log || true + axonivy/build-container:read-the-docs-2 make -C /doc-build html BASEDIR='/workspace/Documentation/portal-guide' VERSION=${{ steps.get_version.outputs.version }} 2> sphinx-warnings.log || true WARNINGS=$(grep -c "WARNING" sphinx-warnings.log || echo 0) echo "locne" 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 + fi + # - name: Install or deploy document # run: | @@ -100,17 +111,4 @@ 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 From 940600f7c744f782feaee822ee09b236ccffc841 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:35:52 +0700 Subject: [PATCH 39/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 0a19dbd806..9478fbeb04 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -74,7 +74,7 @@ jobs: - 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 }} 2> sphinx-warnings.log || true + axonivy/build-container:read-the-docs-2 make -C /doc-build html BASEDIR='/workspace/Documentation/portal-guide' VERSION=${{ steps.get_version.outputs.version }} 2> sphinx-warnings.log WARNINGS=$(grep -c "WARNING" sphinx-warnings.log || echo 0) echo "locne" echo "Found $WARNINGS warnings." From 3f77045b4f39eb354b00e9670873b1e59c917fa5 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:40:26 +0700 Subject: [PATCH 40/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 9478fbeb04..d5beaae9ab 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -57,10 +57,10 @@ jobs: 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: | @@ -110,5 +110,5 @@ jobs: - name: Cleanup shell: bash - run: rm -rf ${{ github.workspace }}/* + run: sudo rm -rf ${{ github.workspace }}/* \ No newline at end of file From 4d74cf9722c1a47f45cdb1a3554e9c2d5dc82fc1 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:44:06 +0700 Subject: [PATCH 41/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index d5beaae9ab..e96ae75be0 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -87,6 +87,7 @@ jobs: echo '```' >> $GITHUB_STEP_SUMMARY cat sphinx-warnings.log >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY + exit 1 fi From 3d98f6970ca6f848a85e61e91c1947b7b628aba2 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 11:49:13 +0700 Subject: [PATCH 42/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 51 ++++++++++----------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index e96ae75be0..2174fdd03d 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -30,9 +30,6 @@ jobs: build-document: runs-on: portal-01 steps: - # - name: test summary - # run: echo "### Documentation Build Warnings" >> $GITHUB_STEP_SUMMARY - - uses: actions/checkout@v4 - name: Set up Java uses: actions/setup-java@v4 @@ -57,26 +54,25 @@ jobs: 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: 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: | 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 }} 2> sphinx-warnings.log WARNINGS=$(grep -c "WARNING" sphinx-warnings.log || echo 0) - echo "locne" echo "Found $WARNINGS warnings." if [ "$WARNINGS" -ge 1 ]; then echo "Documentation build has warnings. Adding to summary..." @@ -90,24 +86,23 @@ jobs: exit 1 fi + - name: Install or deploy document + run: | + if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + PHASE="install" + else + PHASE="deploy" + fi + echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + mvn clean $PHASE -f Documentation/pom.xml - # - name: Install or deploy document - # run: | - # if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then - # PHASE="install" - # else - # PHASE="deploy" - # fi - # echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" - # mvn clean $PHASE -f Documentation/pom.xml - - # - name: Upload artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: documentation - # path: | - # Documentation/*/build/html/**/* - # Documentation/*/target/*.zip + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: documentation + path: | + Documentation/*/build/html/**/* + Documentation/*/target/*.zip - name: Cleanup shell: bash From 9026b7e89713962265c1b9ee2e7ef9e6fff131b5 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 14:09:10 +0700 Subject: [PATCH 43/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 2174fdd03d..07738053d3 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,5 +1,5 @@ name: Portal Documentation -run-name: Build and Deploy Documentation 🚀 +run-name: Build and Deploy Documentation on branch ${{ github.ref_name }} by ${{ github.actor }} 🚀 on: schedule: - cron: '0 0 * * *' # Equivalent to '@midnight' @@ -10,14 +10,14 @@ on: default: 'nightly' required: true - modulesMustBeBuilt: - description: 'Modules that must be built (comma-separated)' + branchToBeBuilt: + description: 'Branch to be built' required: false - default: '' + default: master - push: - branches: - - 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' + # push: + # branches: + # - 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' env: MAVEN_CACHE: /var/tools/maven-cache @@ -31,6 +31,8 @@ jobs: runs-on: portal-01 steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.branchToBeBuilt }} - name: Set up Java uses: actions/setup-java@v4 with: From a857075bbf7af9dda54246d4a4c37421cb79d7a8 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 14:46:07 +0700 Subject: [PATCH 44/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation-12.yml | 97 +++++++++++++++++++ .github/workflows/portal-documentation.yaml | 24 +---- 2 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/portal-documentation-12.yml diff --git a/.github/workflows/portal-documentation-12.yml b/.github/workflows/portal-documentation-12.yml new file mode 100644 index 0000000000..ff76d19da9 --- /dev/null +++ b/.github/workflows/portal-documentation-12.yml @@ -0,0 +1,97 @@ +name: Portal Documentation +run-name: Build and Deploy Documentation on branch release/12.0 by ${{ github.actor }} 🚀 +on: + schedule: + - cron: '0 0 * * *' # Equivalent to '@midnight' + 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 + +jobs: + + build-document: + runs-on: portal01 + steps: + - uses: actions/checkout@v4 + with: + ref: release/12.0 + - 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) + 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: 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 }} 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 + + - name: Install or deploy document + run: | + if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then + PHASE="install" + else + PHASE="deploy" + fi + echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" + mvn clean $PHASE -f Documentation/pom.xml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: Documentation + path: | + Documentation/*/build/html/**/* + Documentation/*/target/*.zip + + - name: Cleanup + shell: bash + run: sudo rm -rf ${{ github.workspace }}/* + \ No newline at end of file diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index 07738053d3..fbf380e0fd 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,5 +1,5 @@ name: Portal Documentation -run-name: Build and Deploy Documentation on branch ${{ github.ref_name }} by ${{ github.actor }} 🚀 +run-name: Build and Deploy Documentation on branch master by ${{ github.actor }} 🚀 on: schedule: - cron: '0 0 * * *' # Equivalent to '@midnight' @@ -10,29 +10,13 @@ on: default: 'nightly' required: true - branchToBeBuilt: - description: 'Branch to be built' - required: false - default: master - - # push: - # branches: - # - 'feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation' - -env: - MAVEN_CACHE: /var/tools/maven-cache - -permissions: - contents: write - jobs: build-document: - runs-on: portal-01 + runs-on: portal01 steps: - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branchToBeBuilt }} + - name: Set up Java uses: actions/setup-java@v4 with: @@ -101,7 +85,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: documentation + name: Documentation path: | Documentation/*/build/html/**/* Documentation/*/target/*.zip From 0d03c123d1f726c75fd437cf58f1d39d69bc3bc4 Mon Sep 17 00:00:00 2001 From: Loc Nguyen Date: Thu, 26 Dec 2024 14:52:26 +0700 Subject: [PATCH 45/45] feature/IVYPORTAL-18151-Create-Github-Action-for-Building-Documentation --- .github/workflows/portal-documentation-12.yml | 97 ------------------- .github/workflows/portal-documentation.yaml | 2 +- 2 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 .github/workflows/portal-documentation-12.yml diff --git a/.github/workflows/portal-documentation-12.yml b/.github/workflows/portal-documentation-12.yml deleted file mode 100644 index ff76d19da9..0000000000 --- a/.github/workflows/portal-documentation-12.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Portal Documentation -run-name: Build and Deploy Documentation on branch release/12.0 by ${{ github.actor }} 🚀 -on: - schedule: - - cron: '0 0 * * *' # Equivalent to '@midnight' - 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 - -jobs: - - build-document: - runs-on: portal01 - steps: - - uses: actions/checkout@v4 - with: - ref: release/12.0 - - 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) - 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: 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 }} 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 - - - name: Install or deploy document - run: | - if [[ "${{ steps.get_version.outputs.version }}" == *SNAPSHOT* ]]; then - PHASE="install" - else - PHASE="deploy" - fi - echo "Running 'clean $PHASE' for version ${{ steps.get_version.outputs.version }}" - mvn clean $PHASE -f Documentation/pom.xml - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: Documentation - path: | - Documentation/*/build/html/**/* - Documentation/*/target/*.zip - - - name: Cleanup - shell: bash - run: sudo rm -rf ${{ github.workspace }}/* - \ No newline at end of file diff --git a/.github/workflows/portal-documentation.yaml b/.github/workflows/portal-documentation.yaml index fbf380e0fd..2f5de28347 100644 --- a/.github/workflows/portal-documentation.yaml +++ b/.github/workflows/portal-documentation.yaml @@ -1,5 +1,5 @@ name: Portal Documentation -run-name: Build and Deploy Documentation on branch master by ${{ github.actor }} 🚀 +run-name: Build and Deploy Documentation on branch ${{ github.ref_name }} 🚀 on: schedule: - cron: '0 0 * * *' # Equivalent to '@midnight'