Skip to content

Commit

Permalink
Add auto-doc workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Luzifix committed Jul 19, 2024
1 parent 02cdd11 commit bf5d9cf
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/auto-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Automatic documentation
on:
push:

jobs:
auto-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet publish --no-restore -o build
- name: Automatic documentation
run: dotnet build/Warcraft.NET.Docs.dll ${{ github.workspace }}/Docs
- name: Commit & Push changes
uses: actions-js/push@master
with:
author_name: Automatic documentation
message: Automatic documentation ${date}'
branch: ${{ github.head_ref || github.ref_name }}
github_token: ${{ secrets.ACTION_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
build/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
3 changes: 3 additions & 0 deletions Docs/ADT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ R = Read Only<br>
N/A = Not in this file for this expansion<br>
**NYI** = Not Yet Implemented / TODO

test


### ADT
|Chunk|LK|WoD|Legion|BfA|SL|DF|TWW|
|-----|-----|-----|-----|-----|-----|-----|-----|
Expand Down
9 changes: 9 additions & 0 deletions Warcraft.NET.Docs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ internal class Program
/// <param name="args"></param>
static void Main(string[] args)
{
Console.WriteLine($"BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}");

if (args.Length == 0)
throw new System.Exception("Please provide an output folder");

string outputFolder = Path.GetFullPath(args[0]);
if (!Directory.Exists(outputFolder))
throw new Exception("Output folder does not exist");

Console.WriteLine($"Output folder: {outputFolder}");

Console.WriteLine("Generating documentation...");
var autoDocData = GenerateAutoDocDataStep.Process();

Console.WriteLine("Converting to markdown...");
ConvertToMarkdownStep.Process(autoDocData, outputFolder);

Console.WriteLine("Done!");
}
}
}
3 changes: 1 addition & 2 deletions Warcraft.NET.Docs/Steps/GenerateAutoDocDataStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ internal static Dictionary<string, Dictionary<string, Dictionary<string, Diction
{
Dictionary<string, Dictionary<string, Dictionary<string, Dictionary<AutoDocChunkVersion, AutoDocChunkImplementation>>>> docData = new();

var classWithDocs =
Assembly.LoadFrom("Warcraft.NET.dll")
var classWithDocs = Assembly.LoadFrom(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Warcraft.NET.dll"))
.GetTypes()
.Where(type => !type.IsAbstract)
.Where(type => type.GetCustomAttribute(typeof(AutoDocFile), false) != null);
Expand Down

0 comments on commit bf5d9cf

Please sign in to comment.