-
Notifications
You must be signed in to change notification settings - Fork 3
163 lines (133 loc) · 5.63 KB
/
portal-documentation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Portal Documentation
run-name: Build and Deploy Documentation 🚀
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
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
permissions:
contents: write
jobs:
build-screenshot:
runs-on: ubuntu-latest
steps:
- 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: 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
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:
# 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: 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 }}/*
# 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)