Skip to content

Commit

Permalink
Fix the github actions not working properly in the newest versions of…
Browse files Browse the repository at this point in the history
… docfx with default settings (dotnet#9430)
  • Loading branch information
ysftulek authored and p-kostov committed Jun 28, 2024
1 parent dc8fbb7 commit 7934880
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,63 @@ To publish to GitHub Pages:
1. [Enable GitHub Pages](https://docs.github.com/en/pages/quickstart).
2. Upload `_site` folder to GitHub Pages using GitHub actions.

This example uses [`peaceiris/actions-gh-pages`](https://github.com/marketplace/actions/github-pages-action) to publish to the `gh-pages` branch:
This is an example GitHub action file that publishes documents to the `gh-pages` branch:

```yaml
# Your GitHub workflow file under .github/workflows/

# Trigger the action on push to main
on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
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:
- name: Checkout
uses: actions/checkout@v3
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
dotnet-version: 8.x

- run: dotnet tool update -g docfx
- run: docfx docfx_project/docfx.json
- run: docfx <docfx-project-path>/docfx.json

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
# Upload entire repository
path: '<docfx-project-path>/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
```
## Use the NuGet Library
You can also use docfx as a NuGet library:
```xml
<PackageReference Include="Docfx.App" Version="2.70.0" />
<PackageReference Include="Docfx.App" Version="2.73.2" />
```

Then build a docset using:
Expand Down

0 comments on commit 7934880

Please sign in to comment.