Skip to content

Commit

Permalink
PRIS-119: automatically publish master branch docs to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Jul 10, 2023
1 parent 0f6d6c5 commit 91fae87
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
branch-management: opennms/[email protected]

executors:
docker-executor:
docker:
Expand All @@ -13,6 +16,9 @@ executors:
go-executor:
docker:
- image: circleci/golang
simple-executor:
docker:
- image: cimg/base:current

commands:
dockerhub-login:
Expand All @@ -26,7 +32,10 @@ commands:
workflows:
build:
jobs:
- build
- build:
filters:
branches:
ignore: gh-pages
- generate-docs:
requires:
- build
Expand Down Expand Up @@ -57,6 +66,15 @@ workflows:
- /^release-.*/
requires:
- smoke-tests
- publish-javadoc:
context:
- "github-releases"
filters:
branches:
only:
- master
requires:
- smoke-tests

jobs:
build:
Expand Down Expand Up @@ -252,3 +270,34 @@ jobs:
cp opennms-pris-dist/target/opennms-pris-release-archive.tar.gz github-latest/opennms-pris-release-$(cat version.txt).tar.gz
cp opennms-pris-dist/target/opennms-pris-release-archive.zip github-latest/opennms-pris-release-$(cat version.txt).zip
ghr -r ${CIRCLE_PROJECT_REPONAME} $(cat version.txt) github-latest
publish-javadoc:
executor: simple-executor
steps:
- attach_workspace:
at: ~/
- add_ssh_keys:
fingerprints:
- "80:24:47:19:df:7b:f3:bf:8a:4d:45:c1:89:88:29:4c"
- run:
name: clone gh-pages branch
command: |
cd ~/project
install -d -m 700 ~/.ssh
curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
git clone --filter=tree:0 --branch gh-pages [email protected]:OpenNMS/opennms-provisioning-integration-server gh-pages
- run:
name: publish updated javadocs
command: |
cd ~/project/gh-pages
rm -rf *
unzip ../target/*-javadoc.jar
git add -A .
git config user.email "[email protected]"
git config user.name "CI/CD System"
git commit -m 'publish latest API docs'
- run:
name: push to gh-pages
command: |
cd ~/project/gh-pages
git push --no-verify origin gh-pages:gh-pages

0 comments on commit 91fae87

Please sign in to comment.