diff --git a/.azure/build-documentation.yml b/.azure/build-documentation.yml index 5cebcbf1ac..a34ca1598a 100644 --- a/.azure/build-documentation.yml +++ b/.azure/build-documentation.yml @@ -20,7 +20,7 @@ trigger: - '*' branches: include: - - '*' + - 'master' pool: vmImage: ubuntu-20.04 @@ -67,14 +67,23 @@ steps: git clone git@github.com:thijsmie/cddstemp.github.io.git documentation-repo name: get_site_repo displayName: Pull documentation repo - - script: | + - bash: | + set -e -x + if [ "$(Build.SourceBranchName)" = "master" ]; then + echo "###vso[task.setvariable variable=docs_tag;]latest" + else + echo "###vso[task.setvariable variable=docs_tag;]$(echo '$(Build.SourceBranchName)' | grep -Eo '^[[:digit:]]\.[[:digit:]]\.[[:digit:]]')" + fi + name: "determine_docu_tag" + displayName: Determine the documentation version number + - bash: | set -e -x - rm -rf "documentation-repo/docs/c/$(Build.SourceBranchName)" || true - cp -R "build/docs/docs" "documentation-repo/docs/c/$(Build.SourceBranchName)" + rm -rf "documentation-repo/docs/c/${DOCS_TAG}" || true + cp -R "build/docs/docs" "documentation-repo/docs/c/${DOCS_TAG})" cd documentation-repo git add "docs/c/$(Build.SourceBranchName)" git config --local user.name "Azure Pipelines" git config --local user.email "azuredevops@microsoft.com" - (git commit -m "Publishing GitHub Pages $(Build.SourceVersion)" && git push -f origin HEAD:master) || true + (git commit -m "Publishing GitHub Pages ${DOCS_TAG}" && git push origin HEAD:master) || true name: 'commit_pages' displayName: Commit new documentation into repo