Skip to content

Commit 8597d74

Browse files
committed
updated github actions and workflow for test purposes
1 parent 8921261 commit 8597d74

4 files changed

Lines changed: 57 additions & 29 deletions

File tree

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ inputs:
99
docfx-json-manifest:
1010
description: 'Path to the docfx JSON manifest file'
1111
required: true
12-
staging-directory:
13-
description: 'Staging directory for generated documentation'
14-
required: true
15-
target-directory:
12+
output-directory:
1613
description: 'Target directory for generated documentation'
1714
required: true
1815
# Optional
@@ -34,16 +31,10 @@ runs:
3431
run: dotnet tool update -g docfx
3532
shell: bash
3633
- name: 'Generate documentation'
37-
run: docfx ${{ inputs.docfx-json-manifest }}
38-
shell: bash
39-
- name: 'Create target directory'
40-
run: mkdir -p ${{ inputs.target-directory }}
41-
shell: bash
42-
- name: 'Move files from staging to target directory'
43-
run: mv ${{ inputs.staging-directory }} ${{ inputs.target-directory }}
34+
run: docfx build ${{ inputs.docfx-json-manifest }} --output ${{ inputs.output-directory }}
4435
shell: bash
4536
- name: Upload artifact
4637
uses: actions/upload-artifact@v4
4738
with:
4839
name: ${{ inputs.artifact-name }}
49-
path: ${{ inputs.target-directory }}
40+
path: ${{ inputs.output-directory }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Generate metadata with docfx'
2+
author: 'Pete Sramek'
3+
description: 'Generate metadata using docfx'
4+
inputs:
5+
# Required
6+
docfx-json-manifest:
7+
description: 'Path to the docfx JSON manifest file'
8+
required: true
9+
assembly-version:
10+
description: 'Assembly version to use for the generated metadata'
11+
required: true
12+
# Optional
13+
dotnet_sdk_version:
14+
description: '.NET SDK version. Default: 9.x'
15+
required: false
16+
default: '9.x'
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
22+
uses: actions/checkout@v4
23+
- name: Dotnet Setup
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: ${{ env.dotnet-sdk-version }}
27+
- name: 'Update docfx tool'
28+
run: dotnet tool update -g docfx
29+
shell: bash
30+
- name: 'Generate documentation'
31+
run: docfx metadata ${{ inputs.docfx-json-manifest }} --output ./api-reference/${{ inputs.assembly-version }}
32+
shell: bash

.github/actions/push-changes/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ author: 'Pete Sramek'
33
description: 'Push changes to a specified branch in the repository.'
44
inputs:
55
# Required
6-
artifact-name:
7-
description: 'Name of the artifact to download before pushing changes.'
8-
required: true
96
working-directory:
107
description: 'The working directory where the changes will be pushed from.'
118
required: true
@@ -20,6 +17,9 @@ inputs:
2017
description: '.NET SDK version. Default: 9.x'
2118
required: false
2219
default: '9.x'
20+
artifact-name:
21+
description: 'Name of the artifact to download before pushing changes.'
22+
required: false
2323

2424
runs:
2525
using: "composite"
@@ -31,6 +31,7 @@ runs:
3131
with:
3232
dotnet-version: ${{ env.dotnet-sdk-version }}
3333
- name: Download a single artifact
34+
if: ${{ inputs.artifact-name != '' }}
3435
uses: actions/download-artifact@v4
3536
with:
3637
name: ${{ inputs.artifact-name }}

.github/workflows/build.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201
name: Docs with docfx
202202
needs: [global-variables, versioning, build]
203203
env:
204-
friendly-version: ${{ needs.versioning.outputs.friendly-version }}
204+
y-version: ${{ needs.versioning.outputs.friendly-version }}
205205
is-release: ${{ needs.global-variables.outputs.is-release }}
206206
is-preview: ${{ needs.global-variables.outputs.is-preview }}
207207
environment:
@@ -211,20 +211,24 @@ jobs:
211211
steps:
212212
- name: 'Checkout ${{ github.head_ref || github.ref }}'
213213
uses: actions/checkout@v4
214-
- name: 'Generate documentation'
215-
uses: ./.github/actions/generate-docs
214+
- name: 'Generate assembly metadata'
215+
uses: ./.github/actions/docfx-metadata
216216
with:
217-
artifact-name: 'docs'
218-
docfx-json-manifest: './docfx/api-reference.json'
219-
staging-directory: './docs/temp/**'
220-
target-directory: './docs/${{ env.friendly-version }}/'
221-
# - name: 'Push documentation to docs branch'
222-
# uses: ./.github/actions/push-changes
223-
# with:
224-
# artifact-name: 'docs'
225-
# working-directory: './docs/${{ env.friendly-version }}/'
226-
# target-branch: 'docs'
227-
# commit-message: 'Update docs for version ${{ env.friendly-version }}'
217+
docfx-json-manifest: './api-reference/version-reference.json'
218+
assembly-version: ${{ needs.versioning.outputs.friendly-version }}
219+
target-directory: './api-reference/${{ env.friendly-version }}/'
220+
- name: 'Push documentation to ${{ github.head_ref || github.ref }} branch'
221+
uses: ./.github/actions/push-changes
222+
with:
223+
working-directory: './api-reference/${{ env.friendly-version }}/'
224+
target-branch: ${{ github.head_ref || github.ref }}
225+
commit-message: 'Update docs for version ${{ env.friendly-version }}'
226+
- name: 'Generate assembly metadata'
227+
uses: ./.github/actions/docfx-build
228+
with:
229+
docfx-json-manifest: './api-reference/api-reference.json'
230+
assembly-version: ${{ needs.versioning.outputs.friendly-version }}
231+
target-directory: './api-reference/${{ env.friendly-version }}/'
228232
- name: Upload artifact
229233
uses: actions/upload-pages-artifact@v3
230234
with:

0 commit comments

Comments
 (0)