Skip to content

Commit 80b27a6

Browse files
committed
Add publishing of docfx to github pages
1 parent a0ebaf4 commit 80b27a6

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/pack.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ on:
77
required: true
88
type: string
99
workflow_dispatch:
10+
inputs:
11+
docs:
12+
description: "Set to 'yes' to deploy docfx to GitHub Pages."
13+
required: false
14+
default: "no"
1015
push:
16+
# Deploy automatically on a new release, automatically publishes docfx to GitHub Pages
17+
release:
18+
types: [published]
1119

1220
env:
1321
DOTNET_NOLOGO: true
@@ -19,6 +27,11 @@ jobs:
1927
runs-on: ubuntu-22.04
2028
permissions:
2129
contents: read
30+
31+
# Expose the docs version as a job-level output
32+
outputs:
33+
doc_version: ${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
34+
2235
steps:
2336
- uses: actions/checkout@v4
2437
with:
@@ -65,3 +78,43 @@ jobs:
6578
with:
6679
name: FastBertTokenizer-nupkg-${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
6780
path: bin/Packages/Release/**/*
81+
82+
#########################################################################
83+
# DEPLOY Docs Job (runs only if release event OR if "docs: yes" manually)
84+
#########################################################################
85+
deploy-docs:
86+
name: Deploy docfx to GitHub Pages
87+
runs-on: ubuntu-22.04
88+
needs: build
89+
90+
# Condition:
91+
# 1) if it's a RELEASE event, OR
92+
# 2) if it's a manual dispatch with docs == 'yes'
93+
# Otherwise, skip
94+
if: >
95+
${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.docs == 'yes') }}
96+
97+
# Pages deployment requires these permissions
98+
permissions:
99+
contents: read
100+
pages: write
101+
id-token: write
102+
103+
steps:
104+
- name: Download docs artifact
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: FastBertTokenizer-docs-${{ needs.build.outputs.doc_version }}
108+
path: docs
109+
110+
- name: Configure Pages
111+
uses: actions/configure-pages@v5
112+
113+
- name: Upload pages artifact
114+
uses: actions/upload-pages-artifact@v3
115+
with:
116+
path: docs
117+
118+
- name: Deploy to GitHub Pages
119+
id: deployment
120+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)