-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move docs publish to GHA-based workflow (#148)
- Loading branch information
Showing
1 changed file
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
name: Publish docs | ||
name: Build & Deploy Docs | ||
|
||
on: [workflow_dispatch] | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
publish_docs_job: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install .NET Core 6.0.x | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
- name: Install .NET Core 7.0.x | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
|
@@ -21,30 +22,36 @@ jobs: | |
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
node-version: 18 | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build & Deploy docs | ||
env: | ||
TARGET_BRANCH: gh-pages | ||
TARGET_DIR: doc-target | ||
- name: Build docs | ||
run: | | ||
sudo apt install libxml2-utils | ||
dotnet tool install -g MarkdownSnippets.Tool | ||
npm install | ||
npm run docs-build | ||
git clone -b ${TARGET_BRANCH} https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git ${TARGET_DIR} | ||
cd ${TARGET_DIR} | ||
git config user.email [email protected] | ||
git config user.name "GitHub Action" | ||
shopt -s extglob | ||
shopt -s dotglob | ||
rm -rf !(.git) 2> /dev/null || true | ||
cp -R ../docs/.vitepress/dist/* . | ||
touch .nojekyll | ||
git add --all | ||
DOCS_VERSION="$(xmllint --xpath "/Project/PropertyGroup/Version/text()" ../src/Alba/Alba.csproj)" | ||
git commit -a -m "Documentation Update for ${DOCS_VERSION}" --allow-empty | ||
git push origin ${TARGET_BRANCH} | ||
touch docs/.vitepress/dist/.nojekyll | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: docs/.vitepress/dist | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
|
||
- name: Generate Algolia DocSearch index | ||
uses: darrenjennings/algolia-docsearch-action@master | ||
|