|
| 1 | +name: 'CD' |
| 2 | + |
| 3 | +# TODO: Remove 'stack' |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + release_tag: |
| 9 | + description: 'The release tag (release version)' |
| 10 | + type: 'string' |
| 11 | + required: true |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: 'docfx-stack' |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +env: |
| 18 | + # Configuration |
| 19 | + GLOBAL_JSON_FILE: 'global.json' |
| 20 | + CACHE_PATTERNS: '["**/*.[cf]sproj*", "**/*.Build.props"]' |
| 21 | + # .NET SDK related environment variables |
| 22 | + DOTNET_NOLOGO: 1 |
| 23 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
| 24 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 25 | + DOTNET_GENERATE_ASPNET_CERTIFICATE: 0 |
| 26 | + |
| 27 | +jobs: |
| 28 | + docfx: |
| 29 | + name: 'Generate API Documentation' |
| 30 | + runs-on: 'ubuntu-latest' |
| 31 | + steps: |
| 32 | + - name: 'Parse Version' |
| 33 | + id: 'version' |
| 34 | + uses: 'zyactions/semver@v1' |
| 35 | + with: |
| 36 | + version: ${{ inputs.release_tag }} |
| 37 | + |
| 38 | + - name: 'Checkout' |
| 39 | + uses: 'actions/checkout@v4' |
| 40 | + |
| 41 | + - name: '.NET Setup' |
| 42 | + uses: 'actions/setup-dotnet@v4' |
| 43 | + with: |
| 44 | + global-json-file: '${{ github.workspace }}/${{ env.GLOBAL_JSON_FILE }}' |
| 45 | + |
| 46 | + - name: 'DocFX Setup' |
| 47 | + run: |- |
| 48 | + dotnet tool update -g docfx |
| 49 | +
|
| 50 | + - name: '.NET Cache Packages' |
| 51 | + uses: 'actions/cache@v4' |
| 52 | + with: |
| 53 | + path: '~/.nuget/packages' |
| 54 | + key: '${{ runner.os }}-nuget-stack-${{ hashFiles(fromJson(env.CACHE_PATTERNS)) }}' |
| 55 | + restore-keys: '${{ runner.os }}-nuget-stack-' |
| 56 | + |
| 57 | + - name: 'DocFx Build' |
| 58 | + working-directory: 'docfx' |
| 59 | + run: |- |
| 60 | + docfx docfx.json |
| 61 | + mv ./_site ./../.. |
| 62 | +
|
| 63 | + - name: 'Checkout' |
| 64 | + uses: 'actions/checkout@v4' |
| 65 | + with: |
| 66 | + ref: 'refdoc' |
| 67 | + |
| 68 | + - name: 'Commit' |
| 69 | + run: |- |
| 70 | + rm -r "./${{ steps.version.outputs.version }}" || true |
| 71 | + mv ../_site "./${{ steps.version.outputs.version }}" |
| 72 | + git config --global user.name '${{ github.actor }}' |
| 73 | + git config --global user.email '${{ github.actor }}@users.noreply.github.com' |
| 74 | + git add . |
| 75 | + git commit -am "Add ${{ steps.version.outputs.version }}" |
| 76 | + git push |
0 commit comments