From a68c8d2317b7e89c754bebeeaf8626d62b7645ed Mon Sep 17 00:00:00 2001 From: Phil Sturgeon <67381+philsturgeon@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:09:05 +0100 Subject: [PATCH 1/2] feat: add azure pipeline example --- azure-pipelines.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..0f955c6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,28 @@ +trigger: + branches: + include: + - '*' + +variables: +- group: bumpsh + +pool: + vmImage: 'ubuntu-latest' + demands: + - npm + +jobs: + - job: validate_doc + # Only run this task if build was triggered by a commit to a branch other than main + condition: and(succeeded(), ne(variables['build.sourceBranch'], 'refs/heads/main')) + steps: + - script: npx bump-cli deploy --dry-run "openapi.yaml" --doc "azure-demo" --token="$BUMP_TOKEN" + displayName: 'Validate API' + + - job: deploy_doc + # Only run this task if build was triggered by a commit to the main branch + condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/main')) + steps: + - script: | + npx bump-cli deploy "openapi.yaml" --doc "azure-demo" --token="$BUMP_TOKEN" + displayName: 'Deploy API Documentation' From 362a7029c444a54cb5aae0d69e91a214e5e6e302 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon <67381+philsturgeon@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:21:08 +0100 Subject: [PATCH 2/2] feat: azure diff and comment --- azure-pipelines.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0f955c6..e2f2ff4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,23 +6,39 @@ trigger: variables: - group: bumpsh + # Set to the location of the main OpenAPI document relative to repo root +- name: openApiDoc + value: openapi.yaml + + # The Documentation ID or Slug found in Bump.sh API Settings +- name: bumpDoc + value: azure-demo + pool: - vmImage: 'ubuntu-latest' + vmImage: ubuntu-latest demands: - npm jobs: - - job: validate_doc + - job: openapi_diff # Only run this task if build was triggered by a commit to a branch other than main condition: and(succeeded(), ne(variables['build.sourceBranch'], 'refs/heads/main')) steps: - - script: npx bump-cli deploy --dry-run "openapi.yaml" --doc "azure-demo" --token="$BUMP_TOKEN" - displayName: 'Validate API' + - script: npx bump-cli deploy --dry-run $(openApiDoc) --doc $(bumpDoc) --token="$BUMP_TOKEN" + displayName: Validate OpenAPI + + - script: npx bump-cli diff --format markdown $(openApiDoc) --doc $(bumpDoc) --token="$BUMP_TOKEN" > bump-diff.md + displayName: Diff OpenAPI + + - task: PullRequestComment@1 + inputs: + markdownFile: $(Build.SourcesDirectory)/bump-diff.md + displayName: PR Comment - - job: deploy_doc + - job: openapi_deploy # Only run this task if build was triggered by a commit to the main branch condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/main')) steps: - script: | - npx bump-cli deploy "openapi.yaml" --doc "azure-demo" --token="$BUMP_TOKEN" - displayName: 'Deploy API Documentation' + npx bump-cli deploy $(openApiDoc) --doc $(bumpDoc) --token="$BUMP_TOKEN" + displayName: Deploy API Documentation