Bump Microsoft.VisualStudio.Azure.Containers.Tools.Targets in /src (#… #704
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: Update OpenAPI Documentation | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Generate swagger | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore Dotnet tools | |
run: dotnet tool restore | |
working-directory: src/ | |
- name: Restore dependencies | |
run: dotnet restore IoTHub.Portal.sln | |
working-directory: src/ | |
- name: Build | |
run: dotnet build IoTHub.Portal.sln --no-restore -p:ClientAssetsRestoreCommand="npm ci" | |
working-directory: src/ | |
- name: Generate Open API documentation | |
run: dotnet swagger tofile --output ./swagger.json IoTHub.Portal.Server/bin/Debug/net8.0/IoTHub.Portal.Server.dll v1 | |
working-directory: src/ | |
env: | |
CloudProvider: Azure | |
# Upload swagger docs to GitHub | |
- uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: swagger-doc | |
path: ./src/swagger.json | |
add-openapi-docs: | |
name: Import OpenAPI to documentation | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/[email protected] | |
with: | |
ref: 'docs/main' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: swagger-doc | |
path: docs | |
- name: Generate app token | |
id: generate_app_token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ secrets.BOT_APP_ID }} | |
private_key: ${{ secrets.BOT_PRIVATE_KEY }} | |
- name: Push Open API Markdown to GitHub | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
base: 'docs/main' | |
branch: 'docs/feature/open-api' | |
commit-message: 'Adds auto-generated Open API doc.' | |
token: ${{ steps.generate_app_token.outputs.token }} | |
title: 'Update API documentation' | |
labels: 'documentation' | |
body: | | |
Automated changes to the Open API documentation. | |
This PR is related to the change **${{ github.event.head_commit.message }}** merged in **${{ github.event.head_commit.id }}**. |