Skip to content

Commit 002ecf2

Browse files
committed
Change travis build to deploy swaggerUi and specs to gh-pages
Also added the swagger specs as release artefacts
1 parent d7e6008 commit 002ecf2

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

.travis.yml

+17-6
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,25 @@ script: ./gradlew -Pversion=$TRAVIS_TAG -PgwtCompilerWorkers=1 downloadUrlDepend
6464
# Conditionally tag git and build docker image.
6565
after_success: "./travis.after_success.sh"
6666

67+
# Deploy the swagger-ui content and swagger specs to gh-pages
6768
# Push to GitHub releases for any tagged commit - the key was generated by the Travis CLI.
6869
deploy:
69-
provider: releases
70-
api_key:
71-
secure: xUPJboaSjxs3lKCqXu5zYzdV75S+lu5EZ6RD+RigmQ5MSjeuFBhoBKYaJUz+ejaoFLfF8WSUbmlgTeRMK7QI4MtCqjy08uREext8sm0behMREz4mmPEb9eTLu+WfIXFbnOPG4pKzkAtHA3x+hNQN3EWga1Xa2WXGYdOuK1B7vnrYOPo9D2zI12JCaoXt0KUQ70LwE07uwBIuDn+0EbVsAftFatJh7jZXeMsE8GmdcwsM/DObKjtTLBH3bpE8pPPJ8H0ssuIsQk2jHg91cTgrlB0q0K1a5TjeKKMGPMY6S6UR9cB7l7FqCVEsOd7T/ExdKp1TflMRyuuKG9ACBXTaegfBt7pP7KYEpYtidC5p/b1J4cYvazVTIfo6m93wnOJAdcD1XeMqNIQZVSxNuflmgM8xZz+UuqPBF4dk3Z5Eoh4sTH+t6WmZY6YoIt6tRMQ8xRyvkTfzsfYUtsV4csyeB2oy5s/GJmYGtR5GjjK6T+mh8RmI/DVWW50ubdFaAYYdz+LSgfpGhBXEBkYPghMSjYiPDsJStXsOwRSQbR9LmRO7jk08PxxT33pLr8Ct0HoQPpSP8Fom4q1ntrZBDjeHL8/2cQtRKqUg3X9G0sU7aW5i0G4U7BE42Xkcc/VVJhFrVbRj5+xQq70uMyUmHi2Wh+mBQSY+ZlBrvr6FRcKj42E=
72-
file: stroom-app/build/libs/stroom-app-all.jar
73-
skip_cleanup: true
74-
on:
70+
- provider: pages
71+
skip_cleanup: true
72+
github_token: $GITHUB_TOKEN
73+
local_dir: gh-pages
74+
target_branch: gh-pages
75+
on:
76+
branch: master
77+
- provider: releases
78+
api_key:
79+
secure: xUPJboaSjxs3lKCqXu5zYzdV75S+lu5EZ6RD+RigmQ5MSjeuFBhoBKYaJUz+ejaoFLfF8WSUbmlgTeRMK7QI4MtCqjy08uREext8sm0behMREz4mmPEb9eTLu+WfIXFbnOPG4pKzkAtHA3x+hNQN3EWga1Xa2WXGYdOuK1B7vnrYOPo9D2zI12JCaoXt0KUQ70LwE07uwBIuDn+0EbVsAftFatJh7jZXeMsE8GmdcwsM/DObKjtTLBH3bpE8pPPJ8H0ssuIsQk2jHg91cTgrlB0q0K1a5TjeKKMGPMY6S6UR9cB7l7FqCVEsOd7T/ExdKp1TflMRyuuKG9ACBXTaegfBt7pP7KYEpYtidC5p/b1J4cYvazVTIfo6m93wnOJAdcD1XeMqNIQZVSxNuflmgM8xZz+UuqPBF4dk3Z5Eoh4sTH+t6WmZY6YoIt6tRMQ8xRyvkTfzsfYUtsV4csyeB2oy5s/GJmYGtR5GjjK6T+mh8RmI/DVWW50ubdFaAYYdz+LSgfpGhBXEBkYPghMSjYiPDsJStXsOwRSQbR9LmRO7jk08PxxT33pLr8Ct0HoQPpSP8Fom4q1ntrZBDjeHL8/2cQtRKqUg3X9G0sU7aW5i0G4U7BE42Xkcc/VVJhFrVbRj5+xQq70uMyUmHi2Wh+mBQSY+ZlBrvr6FRcKj42E=
80+
file:
81+
- stroom-app/build/libs/stroom-app-all.jar
82+
- stroom-app/build/swagger/swagger.json
83+
- stroom-app/build/swagger/swagger.yaml
84+
skip_cleanup: true
85+
on:
7586
tags: true
7687

7788
#clean out gradle caches as per travis docs

travis.after_success.sh

+15
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,19 @@ if [ "$doDockerBuild" = true ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then
5656
docker push gchq/stroom
5757
fi
5858

59+
#Deploy the generated swagger specs and swagger UI (obtained from github) to gh-pages
60+
if [ "$TRAVIS_BRANCH" = "master" ]; then
61+
ghPagesDir=$TRAVIS_BUILD_DIR/gh-pages
62+
swaggerUiCloneDir=$TRAVIS_BUILD_DIR/swagger-ui
63+
mkdir -p $ghPagesDir
64+
#copy our generated swagger specs to gh-pages
65+
cp $TRAVIS_BUILD_DIR/stroom-app/build/swagger/swagger.* $ghPagesDir/
66+
#clone swagger-ui repo so we can get the ui html/js/etc
67+
git clone --depth 1 https://github.com/swagger-api/swagger-ui.git $swaggerUiCloneDir
68+
#copy the bits of swagger-ui that we need
69+
cp -r $swaggerUiCloneDir/dist/* $ghPagesDir/
70+
#repalce the default swagger spec url in swagger UI
71+
sed -i 's#url: ".*"#url: "https://gchq.github.io/stroom/swagger.json"#g' $ghPagesDir/index.html
72+
fi
73+
5974

0 commit comments

Comments
 (0)