Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden gh-pages workflow #1628

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
# This is a basic workflow to help you get started with Actions

name: github-pages

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
branches: [ main ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
branches: [ main ]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read

jobs:
publish-docs:
runs-on: ubuntu-latest

permissions:
contents: write
pages: write

steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- run: dotnet tool restore
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0

- run: dotnet docfx docs/docfx.json
- name: Generate documentation
run: |
dotnet tool restore
dotnet docfx docs/docfx.json

- name: Deploy
if: github.event_name != 'pull_request'
# if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
if: |
github.event.repository.fork == false &&
github.ref_name == github.event.repository.default_branch
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
Expand Down