74 lines
1.7 KiB
YAML
74 lines
1.7 KiB
YAML
name: Deploy Docs
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
paths:
|
|
- 'docs/**'
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths:
|
|
- 'docs/**'
|
|
branches:
|
|
- dev
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Setup DocFX
|
|
run: dotnet tool install -g docfx --version 2.77.0
|
|
|
|
- name: Build DNet docs
|
|
run: docfx docs/docfx.json
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: static-docs
|
|
path: docs/_site
|
|
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: static-docs
|
|
path: output/
|
|
|
|
- name: Add CNAME
|
|
run: echo "${{ vars.DOCS_DOMAIN }}" > output/CNAME
|
|
|
|
- name: Auth DNet bot
|
|
id: bot_auth
|
|
uses: actions/create-github-app-token@v1
|
|
with:
|
|
private-key: ${{ secrets.DNET_BOT_PEM }}
|
|
app-id: ${{ secrets.DNET_BOT_ID }}
|
|
|
|
- name: Push to the Docs Repo
|
|
uses: cpina/github-action-push-to-another-repository@main
|
|
env:
|
|
API_TOKEN_GITHUB: ${{ steps.bot_auth.outputs.token }}
|
|
with:
|
|
source-directory: 'output'
|
|
destination-github-username: 'discord-net'
|
|
destination-repository-name: 'docs-static'
|
|
user-email: dnetbot@discordnet.dev
|
|
target-branch: master
|
|
target-directory: docs
|