1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

chore: add gh-action to generate docs (#1386)

* add workflow to generate docs

* Update documentation.yaml

* Update createDocu.sh

* add caching

* fix c&p error

* Update documentation.yaml

* Update documentation.yaml

* remove docs build from travis

* activate workflow for PRs
This commit is contained in:
Christopher Fenner 2020-04-17 17:44:31 +02:00 committed by GitHub
parent 5e2b2481c3
commit 171a063590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 22 deletions

78
.github/workflows/documentation.yaml vendored Normal file
View File

@ -0,0 +1,78 @@
name: Documentation
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '1.8'
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
- name: Install Groovy
run: sudo apt-get update && sudo apt-get install groovy -y
- name: Cache Maven Packages
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache Go Packages
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: docker pull ppiper/jenkinsfile-runner:latest
- name: Generate Groovy Docs
env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
run: documentation/bin/createDocu.sh
- name: Generate Golang Docs
run: go run pkg/generator/step-metadata.go --docuDir=documentation/docs/steps/ --docuGen=true
- run: docker pull squidfunk/mkdocs-material:3.0.4
- name: Build
run: |
docker run \
-u $(id -u):$(id -g) \
-v ${GITHUB_WORKSPACE}/documentation:/docs \
squidfunk/mkdocs-material:3.0.4 build --clean --strict
- name: Provide Docs Metadata
run: |
mkdir -p documentation/docs-gen/misc
cp target/docuMetaData.json documentation/docs-gen/misc
- name: Deploy
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./documentation/docs-gen
user_name: 'github-actions[bot]'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
keep_files: true
force_orphan: true

View File

@ -25,24 +25,3 @@ jobs:
name: Consumer Tests
if: repo = "SAP/jenkins-library" && ( (type != pull_request && branch =~ /^master$|^it\/.*$/) || (type == pull_request && head_repo = "SAP/jenkins-library" && head_branch =~ /^it\/.*$/) )
script: cd consumer-test && groovy consumerTestController.groovy
- stage: Docs
name: Create Documentation
install: docker pull squidfunk/mkdocs-material:3.0.4
before_script:
- documentation/bin/createDocu.sh
- docker run -u `id -u`:`id -g` --rm -it -e GOCACHE=/tmp -v ${TRAVIS_BUILD_DIR}:/docu-gen golang sh -c "cd /docu-gen && go get github.com/SAP/jenkins-library/... && go run /docu-gen/pkg/generator/step-metadata.go --docuDir=/docu-gen/documentation/docs/steps/ --docuGen=true "
script:
- docker run -u `id -u`:`id -g` --rm -it -v ${TRAVIS_BUILD_DIR}/documentation:/docs squidfunk/mkdocs-material:3.0.4 build --clean --strict
after_script:
- mkdir -p documentation/docs-gen/misc
- cp target/docuMetaData.json documentation/docs-gen/misc
deploy:
on:
branch: master
provider: pages
skip_cleanup: true
github_token: ${GITHUB_TOKEN}
name: 'Travis CI Publisher'
local_dir: 'documentation/docs-gen'
keep_history: true
#verbose: true

View File

@ -18,7 +18,7 @@ do
done
export CLASSPATH_FILE='target/cp.txt'
mvn clean test dependency:build-classpath -Dmdep.outputFile=${CLASSPATH_FILE}
mvn --batch-mode --show-version clean test dependency:build-classpath -Dmdep.outputFile=${CLASSPATH_FILE}
if [ "$?" != "0" ];then
echo "[ERROR] maven test / build-classpath failed"