Skip to content

Descend from the alps/swagger api view #5

Descend from the alps/swagger api view

Descend from the alps/swagger api view #5

name: Generate APIView Artifact
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
AzureSdkForNetDevOpsFeed:
description: 'Azure SDK for .NET DevOps Feed'
default: 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json'
SwaggerApiParserVersion:
description: 'Swagger API Parser Version'
default: '1.3.0-dev.20241029.2'
APIViewArtifactsDirectoryName:
description: 'APIView Artifacts Directory Name'
default: 'SwaggerAPIViewArtifacts'
APIViewArtifactsName:
description: 'APIView Artifacts Name'
default: 'swaggerAPIViewArtifacts'
APIViewAPIUri:
description: 'URI for APIView Creation Endpoint'
default: 'https://apiviewstagingtest.com/PullRequest/DetectAPIChanges'
PullRequestRef:
description: 'Pull Request ref'
default: 'refs/pull/5/merge'
PullRequestNumber:
description: 'Pull Request Number'
default: '5'
env:
AzureSdkForNetDevOpsFeed: ${{ github.event.inputs.AzureSdkForNetDevOpsFeed || 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json' }}
SwaggerApiParserVersion: ${{ github.event.inputs.SwaggerApiParserVersion || '1.3.0-dev.20241029.2' }}
APIViewArtifactsDirectoryName: ${{ github.event.inputs.APIViewArtifactsDirectoryName || 'SwaggerAPIViewArtifacts' }}
APIViewArtifactsName: ${{ github.event.inputs.APIViewArtifactsName || 'swaggerAPIViewArtifacts' }}
APIViewAPIUri: ${{ github.event.inputs.APIViewAPIUri || 'https://apiview.dev/PullRequest/DetectAPIChanges' }}
PullRequestRef: ${{ github.event.pull_request.head.ref || github.event.inputs.PullRequestRef }}
PullRequestNumber: ${{ github.event.pull_request.number || github.event.inputs.PullRequestNumber }}
jobs:
generate-apiview-artifact:
runs-on: ubuntu-latest
outputs:
APIViewArtifactsDirectoryName: ${{ steps.set-outputs.outputs.APIViewArtifactsDirectoryName }}
APIViewArtifactsName: ${{ steps.set-outputs.outputs.APIViewArtifactsName }}
APIViewAPIUri: ${{ steps.set-outputs.outputs.APIViewAPIUri }}
PullRequestRef: ${{ steps.set-outputs.outputs.PullRequestRef }}
PullRequestNumber: ${{ steps.set-outputs.outputs.PullRequestNumber }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ env.PullRequestRef }}
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.x'
- name: Install APIView Swagger Parser
run: |
dotnet tool install Azure.Sdk.Tools.SwaggerApiParser \
--version ${{ env.SwaggerApiParserVersion }} \
--add-source ${{ env.AzureSdkForNetDevOpsFeed }} \
--global
- name: Generate Swagger APIView Tokens
shell: pwsh
run: |
eng/scripts/Create-Swagger-APIView-Artifacts.ps1 `
-TempDirectory ${{ github.workspace }}/temp `
-ArtiFactsStagingDirectory ${{ github.workspace }}/artifacts `
-APIViewArtifactsDirectoryName ${{ env.APIViewArtifactsDirectoryName }}
env:
DOTNET_ROOT: /home/runner/.dotnet
- name: Publish Swagger APIView Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.APIViewArtifactsName }}
path: ${{ github.workspace }}/artifacts/${{ env.APIViewArtifactsDirectoryName }}
- name: Output Env Variables to JSON
run: |
echo '{
"APIViewArtifactsDirectoryName": "${{ env.APIViewArtifactsDirectoryName }}",
"APIViewArtifactsName": "${{ env.APIViewArtifactsName }}",
"APIViewAPIUri": "${{ env.APIViewAPIUri }}",
"PullRequestRef": "${{ env.PullRequestRef }}",
"PullRequestNumber": "${{ env.PullRequestNumber }}",
}' > output-parameters.json
- name: Upload JSON as Artifact
uses: actions/upload-artifact@v3
with:
name: workflow-params
path: output-parameters.json