-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redo deployment using actions/deploy-pages (#362)
- Loading branch information
Showing
4 changed files
with
69 additions
and
60 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,15 +1,25 @@ | ||
name: Build Documentation | ||
|
||
# repository_dispatch is used to trigger the flow from Npgsql/EFCore.PG via HTTP POST | ||
on: [push, pull_request, repository_dispatch] | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
pull_request: | ||
|
||
# Used to trigger the flow from Npgsql/EFCore.PG via HTTP POST | ||
repository_dispatch: | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
@@ -25,14 +35,11 @@ jobs: | |
npm i -g markdownlint-cli | ||
markdownlint "conceptual/**/*.md" | ||
- name: Checkout live branch | ||
uses: actions/checkout@v4 | ||
# Setup software | ||
- name: Setup .NET Core | ||
uses: actions/[email protected] | ||
with: | ||
ref: live | ||
path: live | ||
|
||
- name: Clear live docs repo | ||
run: rm -rf live/* | ||
dotnet-version: 7.0.x | ||
|
||
- name: Checkout Npgsql | ||
uses: actions/checkout@v4 | ||
|
@@ -41,13 +48,7 @@ jobs: | |
ref: docs | ||
path: Npgsql | ||
|
||
# Setup software | ||
- name: Setup .NET Core | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 7.0.x | ||
|
||
# docfx has issues specifically with analyzer/sourcegen projects; build manually before | ||
# docfx has issues specifically with analyzer/sourcegen projects; build manually before. | ||
- name: Build Npgsql | ||
run: dotnet build -c Release | ||
shell: bash | ||
|
@@ -65,27 +66,29 @@ jobs: | |
shell: bash | ||
working-directory: EFCore.PG | ||
|
||
# Note: | ||
# Since we use a custom template to override some properties of the docfx default template, when upgrading docfx we should check | ||
# whether the default template of the new docfx version has changes we need to carry over to our modified version. | ||
# You can get the docfx default template via the following command: docfx template export default | ||
# This will put the default template folder into a directory called _exported_templates | ||
- name: Get docfx | ||
run: dotnet tool install --version 2.77.0 -g docfx | ||
|
||
- name: Build docs | ||
run: docfx --warningsAsErrors | ||
|
||
- name: Commit and push | ||
if: (github.event_name == 'push' || github.event_name == 'repository_dispatch') && github.repository == 'npgsql/doc' && github.ref == 'refs/heads/main' | ||
run: | | ||
export GIT_COMMITTER_NAME=$(git show -s --format='%cn') | ||
export GIT_COMMITTER_EMAIL=$(git show -s --format='%ce') | ||
export GIT_AUTHOR_NAME=$(git show -s --format='%an') | ||
export GIT_AUTHOR_EMAIL=$(git show -s --format='%ae') | ||
export COMMIT_HASH=$(git show -s --format='%H') | ||
export SUBJECT=$(git show -s --format='%s') | ||
cd live | ||
git add . | ||
git commit -m "$SUBJECT" -m "Original commit: $COMMIT_HASH" | ||
git push origin HEAD:live | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: _site | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref_name == 'main' | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,5 +1,5 @@ | ||
obj | ||
/EFCore.PG | ||
/Npgsql | ||
/live | ||
/_site | ||
/_exported_templates |
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
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