Skip to content

Bump docker/build-push-action from 4.2.0 to 4.2.1 (#2498) #417

Bump docker/build-push-action from 4.2.0 to 4.2.1 (#2498)

Bump docker/build-push-action from 4.2.0 to 4.2.1 (#2498) #417

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/checkout@v4.0.0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.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/net7.0/IoTHub.Portal.Server.dll v1
working-directory: src/
env:
CloudProvider: Azure
# Upload swagger docs to GitHub
- uses: actions/upload-artifact@v3
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/checkout@v4.0.0
with:
ref: 'docs/main'
- uses: actions/download-artifact@v3
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@v5
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 }}**.