Skip to content

Commit

Permalink
Add build setup for swagger-ui-dist
Browse files Browse the repository at this point in the history
  • Loading branch information
shockey committed Apr 22, 2017
1 parent 06c82bb commit e871871
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,28 @@ branches:
only:
- master
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
before_deploy: "npm run build-core"
before_deploy:
- npm run build
env:
- DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
deploy:
provider: npm
email: [email protected]
skip_cleanup: true
api_key:
secure: "IJkLaACa+rfERf1O5nwlqOyuo9sbul3FBhBt4Un9P+DvEet3AoDPV9NQVLd8SkmQYKGbGQWF4BIdjrO5nqFD6Te+JTeUX5Uo/DFS/fu9qw1xv0dQpvbJFuoYnnFlbzGTEs4CFa8lbu3ZromFHQGOQxRobjsG1Kf0dWFSSzmND3g="
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
- provider: npm
email: [email protected]
skip_cleanup: true
api_key:
secure: "IJkLaACa+rfERf1O5nwlqOyuo9sbul3FBhBt4Un9P+DvEet3AoDPV9NQVLd8SkmQYKGbGQWF4BIdjrO5nqFD6Te+JTeUX5Uo/DFS/fu9qw1xv0dQpvbJFuoYnnFlbzGTEs4CFa8lbu3ZromFHQGOQxRobjsG1Kf0dWFSSzmND3g="
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
- provider: script
script: swagger-ui-dist-package/deploy.sh
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
after_success:
- if [ $DOCKER_HUB_USERNAME ]; then
- if [ $DOCKER_HUB_USERNAME ]; then
docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;

if [ ! -z "$TRAVIS_TAG" ]; then
Expand All @@ -40,4 +47,3 @@ after_success:
docker push $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG;
fi;
fi;

2 changes: 2 additions & 0 deletions swagger-ui-dist-package/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
deploy.sh
1 change: 1 addition & 0 deletions swagger-ui-dist-package/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
3 changes: 3 additions & 0 deletions swagger-ui-dist-package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory is used to build the `swagger-ui-dist` npm package.

For anything else, check the [Swagger-UI](https://github.com/swagger-api/swagger-ui) repository.
21 changes: 21 additions & 0 deletions swagger-ui-dist-package/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Deploy `swagger-ui-dist` to npm.

# Parameter Expansion: http://stackoverflow.com/questions/6393551/what-is-the-meaning-of-0-in-a-bash-script
cd "${0%/*}"

# Get UI version
UI_VERSION=$(node -p "require('../package.json').version")

# Replace our version placeholder with UI's version
sed -i '' "s|\$\$VERSION|$UI_VERSION|g" package.json

# Copy UI's dist files to our directory
cp ../dist/* .

if [[ $PUBLISH_DIST = "true" || $TRAVIS = "true" ]]; then
npm publish .
else
npm pack .
fi

rm !(README.md|package.json|deploy.sh)
18 changes: 18 additions & 0 deletions swagger-ui-dist-package/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "swagger-ui-dist",
"version": "$$VERSION",
"main": "dist/swagger-ui.js",
"repository": "[email protected]:swagger-api/swagger-ui.git",
"contributors": [
"(in alphabetical order)",
"Anna Bodnia <[email protected]>",
"Buu Nguyen <[email protected]>",
"Josh Ponelat <[email protected]>",
"Kyle Shockey <[email protected]>",
"Robert Barnwell <[email protected]>",
"Sahar Jafari <[email protected]>"
],
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {}
}

0 comments on commit e871871

Please sign in to comment.