Update openapi.yml #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check & deploy API documentation | |
permissions: | |
contents: read | |
pull-requests: write | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
deploy-doc: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
name: Deploy API documentation on Bump.sh | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '7.0.x' | |
- name: Build solution | |
run: dotnet build | |
- name: Install Swashbuckle.AspNetCore.Cli | |
run: | | |
dotnet tool install Swashbuckle.AspNetCore.Cli --global | |
echo "${DOTNET_ROOT}/tools/swagger" >> $GITHUB_PATH | |
- name: Generate OpenAPI YAML | |
run: swagger tofile --output openapi.yaml --yaml ./src/CrowdParlay.Social.Api/bin/Debug/net7.0/CrowdParlay.Social.Api.dll v1 | |
- name: Deploy API documentation | |
uses: bump-sh/github-action@v1 | |
with: | |
doc: ${{ vars.BUMP_SH_DOCUMENTATION }} | |
token: ${{ secrets.BUMP_SH_TOKEN }} | |
file: openapi.yaml | |
- name: 🎁 Publish GitHub release | |
id: publish-github-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: test | |
release_name: test | |
body: Sample body. | |
- name: Upload OpenAPI YAML as Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.publish-github-release.outputs.upload_url }} | |
asset_path: ./openapi.yaml | |
asset_name: openapi.yaml | |
asset_content_type: application/yaml | |
api-diff: | |
if: ${{ github.event_name == 'pull_request' }} | |
name: Check API diff on Bump.sh | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Comment pull request with API diff | |
uses: bump-sh/github-action@v1 | |
with: | |
doc: ${{ vars.BUMP_SH_DOCUMENTATION }} | |
token: ${{ secrets.BUMP_SH_TOKEN }} | |
file: openapi.yaml | |
command: diff | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |