Skip to content

dispatch-build-website #1821

dispatch-build-website

dispatch-build-website #1821

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