Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add azure pipeline example #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
trigger:
branches:
include:
- '*'

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
demands:
- npm

jobs:
- 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 $(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: 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 $(openApiDoc) --doc $(bumpDoc) --token="$BUMP_TOKEN"
displayName: Deploy API Documentation