Skip to content

Commit

Permalink
Merge pull request #98 from gpproton/setup-docfx-for-axolotl
Browse files Browse the repository at this point in the history
Setup docfx for axolotl
  • Loading branch information
gpproton authored Apr 2, 2024
2 parents 54f9c0e + 53fc064 commit b71adc7
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"commands": [
"dotnet-ef"
]
},
"docfx": {
"version": "2.75.3",
"commands": [
"docfx"
]
}
}
}
40 changes: 40 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Generate docs with docfx

on:
push:
branches:
- main

permissions:
actions: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Dotnet Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- run: dotnet tool restore
- run: dotnet r docs:publish

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,6 @@ $RECYCLE.BIN/
*.lnk
.idea
*.sqlite*
*.db*
*.db*
_site
docs/api
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Axolotl

A personal shared library for various types of dotnet project types
A personal shared library for various types of dotnet project types

NOTE: Issues can be created to improve documentation and fix errors

Expand Down
45 changes: 45 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"metadata": [
{
"src": [
{
"src": "../src",
"files": [
"**/*.csproj"
]
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"assets/**"
]
}
],
"output": "_site",
"template": [
"default",
"modern"
],
"globalMetadata": {
"_appName": "Axolotl",
"_appTitle": "Axolotl",
"_enableSearch": true,
"pdf": true
}
}
}
1 change: 1 addition & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Getting Started
44 changes: 44 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
_layout: landing
---

A personal shared library for various types of dotnet project types.

## packages

- Axolotl
- Axolotl.Http
- Axolotl.EFCore
- Axolotl.Razor

# Install

The framework is provided as a set of NuGet packages. In many cases you'll only need the base package, but if you need efcore or razor there are implementation-specific packages available to assist.

To install the run any of the following required pakage:

```ps1
Install-Package Axolotl
Install-Package Axolotl.EFCore
Install-Package Axolotl.AspNet
```

```csharp
public sealed class Post : AuditableEntity<Guid> {
public string Title { get; set; } = null!;
public Category Category { get; set; } = null!;
public ICollection<Tag> Tags { get; set; } = null!;
}
```

### Create your DB context

```csharp
public class ServiceContext : DbContext {
public ServiceContext(DbContextOptions<ServiceContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder) { }

public virtual DbSet<Post> Posts { get; set; } = null!;

}
```
6 changes: 6 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: Home
href: /
- name: Getting Started
href: getting-started.md
- name: API
href: api/
6 changes: 4 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"sdk": {
"version": "8.0.100-preview.4.23260.5",
"rollForward": "latestFeature"
"version": "8.0.200",
"rollForward": "latestPatch"
},
"scripts": {
"docs": "cd docs && dotnet docfx docfx.json --serve",
"docs:publish": "cd docs && dotnet docfx docfx.json",
"build": "dotnet build --configuration Release",
"test": "dotnet test --configuration Release",
"ci": "dotnet r build && dotnet r test",
Expand Down

0 comments on commit b71adc7

Please sign in to comment.