forked from devonfw/devonfw.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (149 loc) · 6.01 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
name: build-and-deploy
on:
workflow_run:
workflows: ["Dispcher event on update of devonfw guide"]
types:
- completed
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Configure git
run: |
git config --global fetch.parallel 20
- name: Clone
uses: actions/checkout@v1
with:
submodules: recursive
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: SetupRuby
uses: actions/setup-ruby@v1
with:
ruby-version: "2.x"
- name: Setup Node
uses: actions/setup-node@v2
- 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 architectures/scripts
npm install
node copySolutionsFromStack.js ../../devonfw-guide
cd ../../
- name: Copy pom files for architectures
run: |
chmod +x architectures/scripts/copyPomFiles.sh
architectures/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 architectures
run: |
cd architectures/scripts
npm install
cd ../../
- name: Compile sass for architectures
uses: gha-utilities/[email protected]
with:
source: architectures/index.scss
destination: architectures/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 architectures/README.md || true
rm architectures/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 -s ./.m2/unblock-rubygem-proxy-settings.xml clean package
- 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 video-to-iframe.js ../target/generated-docs/website/pages/resources/resources.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 architectures
run: |
chmod +x architectures/scripts/createOutput.sh
architectures/scripts/createOutput.sh
- name: Copy output of architectures
run: |
cp -avr architectures/target/generated-docs/ target/generated-docs/website/pages/architectures/
- 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/ ../architectures/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*
- name: Deploy
uses: peaceiris/[email protected]
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: master
PUBLISH_DIR: ./target/generated-docs