From 11e714421c4e506ce76f1293292a82c48820e753 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Wed, 20 Nov 2024 11:58:23 +0100 Subject: [PATCH] Implement automatic API docs generation --- .github/workflows/test.yml | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..a4feae8819 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,70 @@ +name: Test + +on: [pull_request] + +env: + # Configuration + GLOBAL_JSON_FILE: 'global.json' + CACHE_PATTERNS: '["**/*.[cf]sproj*", "**/*.Build.props"]' + # .NET SDK related environment variables + DOTNET_NOLOGO: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_GENERATE_ASPNET_CERTIFICATE: 0 + # Inputs + flavor: 'stack' + solution: 'Packages.Stack.slnf' + +jobs: + docfx: + name: 'Generate API Documentation' + runs-on: 'ubuntu-latest' + steps: + - name: 'Parse Version' + id: 'version' + uses: 'zyactions/semver@v1' + with: + version: '0.0.0' + prefixes: 'serverless-' + + - name: 'Checkout' + uses: 'actions/checkout@v4' + + - name: '.NET Setup' + uses: 'actions/setup-dotnet@v4' + with: + global-json-file: '${{ github.workspace }}/${{ env.GLOBAL_JSON_FILE }}' + + - name: 'DocFX Setup' + run: |- + dotnet tool update -g docfx + + - name: '.NET Cache Packages' + uses: 'actions/cache@v4' + with: + path: '~/.nuget/packages' + key: '${{ runner.os }}-nuget-${{ env.flavor }}-${{ hashFiles(fromJson(env.CACHE_PATTERNS)) }}' + restore-keys: '${{ runner.os }}-nuget-${{ env.flavor }}-' + + - name: '.NET Restore' + run: |- + dotnet restore "${{ github.workspace }}/${{ env.solution }}" + + - name: 'DocFx Build' + working-directory: 'docfx' + run: |- + docfx docfx.json + mv ./_site ./../.. + + - name: 'Checkout' + uses: 'actions/checkout@v4' + with: + ref: 'docfx' + + - name: 'Commit' + run: |- + mv ../_site "./${{ steps.version.outputs.version }}" + git config --global user.name '${{ github.actor }}' + git config --global user.email '${{ github.actor }}@users.noreply.github.com' + git commit -am "Add ${{ steps.version.outputs.version }}" + git push