Skip to content

Commit

Permalink
[FABCN-391] Update publish JSDoc job
Browse files Browse the repository at this point in the history
Publish to a minor version release directory except on the master branch

Signed-off-by: James Taylor <jamest@uk.ibm.com>
  • Loading branch information
jt-nti committed Apr 7, 2020
1 parent 4a806dd commit efae4d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ stages:
# Build and publish API docs on every merge build
- job: jsdoc
dependsOn: displayenv
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
variables:
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
jsdoc_release: master
${{ if ne(variables['Build.SourceBranch'], 'refs/heads/master') }}:
jsdoc_release: release-$(BuildData.MINOR_PACKAGE_VERSION)
steps:
- script: |
set -ev
Expand Down Expand Up @@ -239,9 +245,9 @@ stages:
git checkout -b gh-pages origin/gh-pages
git clean -xdf
mkdir -p $(Build.SourceBranchName)/api
rm -rf $(Build.SourceBranchName)/api/*
cp -r $(Build.ArtifactStagingDirectory)/jsdoc/gen/* $(Build.SourceBranchName)/api
mkdir -p $(jsdoc_release)/api
rm -rf $(jsdoc_release)/api/*
cp -r $(Build.ArtifactStagingDirectory)/jsdoc/gen/* $(jsdoc_release)/api
if [ -d $(Build.ArtifactStagingDirectory)/gh-pages ]; then
find . -maxdepth 1 ! \( -name [.]* -o -name 'gh-pages' -o -name 'master' -o -name 'release-*' \) -exec rm -rf {} \;
cp -r $(Build.ArtifactStagingDirectory)/gh-pages/* .
Expand Down
5 changes: 5 additions & 0 deletions ci/templates/build-data.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
steps:
- script: |
env | sort
# handle full version number
VERSION=$(jq '.version' $(Build.SourcesDirectory)/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/")
echo Current version in code is :${VERSION}:
echo "##vso[task.setvariable variable=PACKAGE_VERSION;isOutput=true]${VERSION}"
# handle minor version
MINOR_VERSION=$(jq '.version' $(Build.SourcesDirectory)/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9])\.[0-9]?[0-9].*/\1/")
echo Current minor version in code is :${MINOR_VERSION}:
echo "##vso[task.setvariable variable=MINOR_PACKAGE_VERSION;isOutput=true]${MINOR_VERSION}"
name: BuildData
displayName: 'Build data'

0 comments on commit efae4d0

Please sign in to comment.