-
Notifications
You must be signed in to change notification settings - Fork 36
216 lines (181 loc) · 7.38 KB
/
build-and-deploy.yml
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: build-and-deploy
on:
push:
branches: [ main ]
repository_dispatch:
types: [dispatch-build-website]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Configure git
run: |
git config --global fetch.parallel 20
- name: Shallow Clone with Submodules
run: |
git clone https://${{ github.token }}@github.com/${{ github.repository }}.git --recurse-submodules --single-branch .
- name: Starting RubyGem Maven Proxy
run: |
# mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dartifact=de.saumya.mojo:rubygems:0.2.3:war -DoutputDirectory=.
git clone https://github.com/devonfw/rubygems-servlets.git
cd rubygems-servlets
mvn clean package -Pexecutable
java -jar target/rubygems.war &
cd ..
- name: SetupRuby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install asciidoctor Gem
run: gem install asciidoctor -v 1.5.7.1
- name: RenameHomeFiles
run: |
cd general-scripts
npm install
node renamer.js ../devonfw-guide/ Home .asciidoc
cd ..
- name: Solutions from Stack repositories
run: |
cd solutions/scripts
npm install
node copySolutionsFromStack.js ../../devonfw-guide
cd ../../
- name: Copy pom files for solutions
run: |
chmod +x solutions/scripts/copyPomFiles.sh
solutions/scripts/copyPomFiles.sh
- name: Copy pom files for tutorials
run: |
chmod +x wiki-tutorials/scripts/copyPomFiles.sh
wiki-tutorials/scripts/copyPomFiles.sh
- name: npm install for solutions
run: |
cd solutions/scripts
npm install
cd ../../
- name: npm install for tutorials
run: |
cd wiki-tutorials/scripts
npm install
cd ../../
- name: Fix includes of solutions
run: |
node solutions/scripts/fixIncludeFiles.js ./solutions/solutions/ ./solutions/includes/
- name: Compile sass for solutions
uses: gha-utilities/[email protected]
with:
source: solutions/index.scss
destination: solutions/index.css
- name: Compile sass for tutorials
uses: gha-utilities/[email protected]
with:
source: wiki-tutorials/index.scss
destination: wiki-tutorials/index.css
# asciidoctor tries to load gems dynamically to convert md and scss files.
# As this gems are not installed this is breaking the build.
- name: Remove files that are breaking the build
run: |
rm solutions/README.md || true
rm solutions/index.scss || true
rm wiki-tutorials/README.md || true
rm wiki-tutorials/index.scss || true
- name: npm install for asciidoctor-stylesheet
run: |
cd asciidoctor-stylesheet
npm install
cd ../
- name: Build
run: |
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dartifact=de.saumya.mojo:rubygems:0.2.3:war -DoutputDirectory=.
java -jar rubygems-0.2.3.war &
sleep 30
mvn -s ./.m2/settings-local-rubygems-proxy.xml clean package -Doutput.format=html
- name: Make IDs unique
run: |
cd general-scripts
npm install
node correct-ids.js ../target/asciidoc/devonfw-guide/
cd ..
- name: Remove section numbers
run: |
cd general-scripts
npm install
node remove-section-numbers.js ../target/asciidoc/
cd ..
- name: SplitHtml
run: |
asciidoctor -r ./asciidoctor-extensions/multipage-html5-converter.rb -b multipage_html5 ./target/asciidoc/devonfw-guide/master.asciidoc -a toc=left -a toclevels=3 -a multipage-level=2 -D ./target/generated-docs/website/pages/docs
cp -avr target/generated-docs/images/ target/generated-docs/website/pages/docs/
- name: Postprocessing
run: |
cd general-scripts
npm install
node merger.js ../target/generated-docs/devonfw-guide/master.html ../target/generated-docs/website/pages/docs/ ../target/generated-docs/website/pages/docs/
node merge-explore.js page-explore.html ../target/generated-docs/website/pages/explore/explore.html ../target/generated-docs/website/pages/explore/ ../target/generated-docs/website/pages/explore/ explore.html
node rereferencer/rereference.js ../../target/asciidoc/devonfw-guide/ ../../target/generated-docs/website/pages/docs/
node highlight-current.js ../target/generated-docs/website
cd ..
- name: Create output for solutions
run: |
chmod +x solutions/scripts/createOutput.sh
solutions/scripts/createOutput.sh
- name: Copy output of solutions
run: |
cp -avr solutions/target/generated-docs/ target/generated-docs/website/pages/solutions/
mv target/generated-docs/website/pages/solutions/solutions target/generated-docs/website/pages/solutions/solution
- name: Create output for tutorials
run: |
chmod +x wiki-tutorials/scripts/createOutput.sh
wiki-tutorials/scripts/createOutput.sh
- name: Copy output of tutorials
run: |
cp -avr wiki-tutorials/target/generated-docs/ target/generated-docs/website/pages/learning/
- name: Build and test search engine
run: |
cd website/components/header/search-engine
npm install
npm run test
npm run build
cp ./dist/bundle.js ../../../../target/generated-docs/website/components/header/search-engine
ls -al ../../../../target/generated-docs/website/components/header/search-engine
cd ../../../../
- name: Reindex
run: |
cd search-engine
npm install
node ./converter.js ../target/generated-docs/website/pages/docs/ ../solutions/solutions/ ../target/generated-docs/website/components/header/search-engine
ls -al ../target/generated-docs/website/components/header/search-engine
cd ../
- name: Cleanup
run: |
cd target/generated-docs
rm -Rf asciidoctor* documentation pom.xml README.html rubygems*
cd ../../
##--------------- antora pipeline ----------------##
- name: npm install for antora-cli
run: |
npm install
- name: Build Antora
run: |
npm run build
- name: Copy static
run: |
cp -avr ./static/. ./target/generated-docs/
- name: Deploy
uses: peaceiris/[email protected]
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./target/generated-docs
- name: Dispatch Website Link-Check
uses: guilouro/[email protected]
with:
repo_token: ${{ secrets.GHA_TOKEN }}
event_type: dispatch-website-linkcheck
repositories: |
devonfw/devonfw.github.io