* Added autodoc builder step

* Added ignore badges branch for push events

* Fixed doc builder
This commit is contained in:
Felix Weiß
2023-07-07 00:11:30 +02:00
committed by GitHub
parent 6cb45ac27d
commit befadb67a5
2 changed files with 35 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ on:
required: false required: false
type: string type: string
push: push:
branches-ignore:
- badges
paths-ignore: paths-ignore:
- '**.md' - '**.md'
@@ -37,6 +39,25 @@ jobs:
- name: 'Run tests' - name: 'Run tests'
run: dotnet test "./MewtocolTests" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../Builds/TestResults/coverage.opencover.xml run: dotnet test "./MewtocolTests" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../Builds/TestResults/coverage.opencover.xml
- name: 'Run docbuilder'
run: dotnet run --project "./DocBuilder/DocBuilder.csproj" "./DocBuilder/Docs/plctypes.md"
- name: 'Commit generated docs to branch'
run: |
git fetch
git checkout ${{ steps.extract_branch.outputs.branch }}
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add "./DocBuilder/Docs/plctypes.md" -f
git commit -m "(AUTO_DOC) add documentation for branch ${{ steps.extract_branch.outputs.branch }}"
- name: 'Push docs commit'
uses: ad-m/github-push-action@master
if: ${{ success() }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}
- name: Report Generator - name: Report Generator
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22 uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22
with: with:
@@ -74,7 +95,7 @@ jobs:
git add "./Builds/TestResults/summary_${{ steps.extract_branch.outputs.branch }}.html" -f git add "./Builds/TestResults/summary_${{ steps.extract_branch.outputs.branch }}.html" -f
git commit -m "Add/Update badge for branch ${{ steps.extract_branch.outputs.branch }}" git commit -m "Add/Update badge for branch ${{ steps.extract_branch.outputs.branch }}"
- name: Push badge commit - name: 'Push badge commit'
uses: ad-m/github-push-action@master uses: ad-m/github-push-action@master
if: ${{ success() }} if: ${{ success() }}
with: with:

View File

@@ -17,7 +17,18 @@ Console.WriteLine("Building docs for PLC types...");
var entryLoc = Assembly.GetEntryAssembly(); var entryLoc = Assembly.GetEntryAssembly();
ArgumentNullException.ThrowIfNull(entryLoc); ArgumentNullException.ThrowIfNull(entryLoc);
string filePath = Path.Combine(entryLoc.Location, @"..\..\..\..\Docs\plctypes.md"); string filePath = null!;
if(args.Length == 0) {
filePath = Path.Combine(entryLoc.Location, @"..\..\..\..\Docs\plctypes.md");
} else {
filePath = args[0];
}
Console.WriteLine($"{filePath}"); Console.WriteLine($"{filePath}");
StringBuilder markdownBuilder = new StringBuilder(); StringBuilder markdownBuilder = new StringBuilder();