Skip to content

Commit 0ad66c0

Browse files
authored
Redo deployment using actions/deploy-pages (#362)
1 parent f0b189d commit 0ad66c0

4 files changed

Lines changed: 69 additions & 60 deletions

File tree

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
name: Build Documentation
22

3-
# repository_dispatch is used to trigger the flow from Npgsql/EFCore.PG via HTTP POST
4-
on: [push, pull_request, repository_dispatch]
3+
on:
4+
push:
5+
branches: [main]
6+
7+
pull_request:
8+
9+
# Used to trigger the flow from Npgsql/EFCore.PG via HTTP POST
10+
repository_dispatch:
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
518

619
jobs:
720
build:
821
runs-on: ubuntu-22.04
922

10-
permissions:
11-
contents: write
12-
1323
steps:
1424
- name: Checkout repo
1525
uses: actions/checkout@v4
@@ -25,14 +35,11 @@ jobs:
2535
npm i -g markdownlint-cli
2636
markdownlint "conceptual/**/*.md"
2737
28-
- name: Checkout live branch
29-
uses: actions/checkout@v4
38+
# Setup software
39+
- name: Setup .NET Core
40+
uses: actions/setup-dotnet@v4.0.1
3041
with:
31-
ref: live
32-
path: live
33-
34-
- name: Clear live docs repo
35-
run: rm -rf live/*
42+
dotnet-version: 7.0.x
3643

3744
- name: Checkout Npgsql
3845
uses: actions/checkout@v4
@@ -41,13 +48,7 @@ jobs:
4148
ref: docs
4249
path: Npgsql
4350

44-
# Setup software
45-
- name: Setup .NET Core
46-
uses: actions/setup-dotnet@v4.0.1
47-
with:
48-
dotnet-version: 7.0.x
49-
50-
# docfx has issues specifically with analyzer/sourcegen projects; build manually before
51+
# docfx has issues specifically with analyzer/sourcegen projects; build manually before.
5152
- name: Build Npgsql
5253
run: dotnet build -c Release
5354
shell: bash
@@ -65,27 +66,29 @@ jobs:
6566
shell: bash
6667
working-directory: EFCore.PG
6768

68-
# Note:
69-
# Since we use a custom template to override some properties of the docfx default template, when upgrading docfx we should check
70-
# whether the default template of the new docfx version has changes we need to carry over to our modified version.
71-
# You can get the docfx default template via the following command: docfx template export default
72-
# This will put the default template folder into a directory called _exported_templates
7369
- name: Get docfx
7470
run: dotnet tool install --version 2.77.0 -g docfx
7571

7672
- name: Build docs
7773
run: docfx --warningsAsErrors
7874

79-
- name: Commit and push
80-
if: (github.event_name == 'push' || github.event_name == 'repository_dispatch') && github.repository == 'npgsql/doc' && github.ref == 'refs/heads/main'
81-
run: |
82-
export GIT_COMMITTER_NAME=$(git show -s --format='%cn')
83-
export GIT_COMMITTER_EMAIL=$(git show -s --format='%ce')
84-
export GIT_AUTHOR_NAME=$(git show -s --format='%an')
85-
export GIT_AUTHOR_EMAIL=$(git show -s --format='%ae')
86-
export COMMIT_HASH=$(git show -s --format='%H')
87-
export SUBJECT=$(git show -s --format='%s')
88-
cd live
89-
git add .
90-
git commit -m "$SUBJECT" -m "Original commit: $COMMIT_HASH"
91-
git push origin HEAD:live
75+
- name: Upload artifact
76+
uses: actions/upload-pages-artifact@v3
77+
with:
78+
path: _site
79+
80+
deploy:
81+
needs: build
82+
runs-on: ubuntu-latest
83+
if: github.event_name == 'push' && github.ref_name == 'main'
84+
permissions:
85+
contents: read
86+
pages: write
87+
id-token: write
88+
environment:
89+
name: github-pages
90+
url: ${{ steps.deployment.outputs.page_url }}
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
obj
22
/EFCore.PG
33
/Npgsql
4-
/live
4+
/_site
55
/_exported_templates

conceptual/EF6.PG/index.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
---
2-
layout: doc
3-
title: Entity Framework 6
4-
---
1+
# Entity Framework 6
52

63
Npgsql has an Entity Framework 6 provider. You can use it by installing the
74
[EntityFramework6.Npgsql](https://www.nuget.org/packages/EntityFramework6.Npgsql/) nuget.
85

9-
## Basic Configuration ##
6+
## Basic Configuration
107

118
Configuration for an Entity Framework application can be specified in a config file (app.config/web.config) or through code. The latter is known as code-based configuration.
129

13-
### Code-based ###
10+
### Code-based
1411

1512
To use Entity Framework with Npgsql, define a class that inherits from `DbConfiguration` in the same assembly as your class inheriting `DbContext`. Ensure that you configure provider services, a provider factory, a default connection factory as shown below:
1613

@@ -35,7 +32,7 @@ class NpgSqlConfiguration : DbConfiguration
3532
}
3633
```
3734

38-
### Config file ###
35+
### Config file
3936

4037
When installing `EntityFramework6.Npgsql` nuget package, the relevant sections in `App.config` / `Web.config` are usually automatically updated. You typically only have to add your `connectionString` with the correct `providerName`.
4138

@@ -59,7 +56,7 @@ When installing `EntityFramework6.Npgsql` nuget package, the relevant sections i
5956
</configuration>
6057
```
6158

62-
## Guid Support ##
59+
## Guid Support
6360

6461
Npgsql EF migrations support uses `uuid_generate_v4()` function to generate guids.
6562
In order to have access to this function, you have to install the extension uuid-ossp through the following command:
@@ -78,7 +75,7 @@ If the database is being created by Npgsql Migrations, you will need to
7875
[run the `create extension` command in the `template1` database](http://stackoverflow.com/a/11584751).
7976
This way, when the new database is created, the extension will be installed already.
8077

81-
## Optimistic Concurrency ##
78+
## Optimistic Concurrency
8279

8380
EntityFramework supports [optimistic concurrency](https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application), through the [system column `xmin`](https://www.postgresql.org/docs/current/ddl-system-columns.html). To use this column as the concurrency token, some [customization is needed](https://github.com/npgsql/EntityFramework6.Npgsql/issues/8). The following code will setup `Department.Version` to map to `xmin`, while the `SqlGenerator` will generate `CREATE/ALTER TABLE` statements omitting system columns.
8481

@@ -126,15 +123,15 @@ public class SqlGenerator : NpgsqlMigrationSqlGenerator
126123
}
127124
```
128125

129-
## Template Database ##
126+
## Template Database
130127

131128
When the Entity Framework 6 provider creates a database, it issues a simple `CREATE DATABASE` command.
132129
In PostgreSQL, this implicitly uses `template1` as the template - anything existing in `template1` will
133130
be copied to your new database. If you wish to change the database used as a template, you can specify
134131
the `EF Template Database` connection string parameter. For more info see the
135132
[PostgreSQL docs](https://www.postgresql.org/docs/current/static/sql-createdatabase.html).
136133

137-
## Customizing DataReader Behavior ##
134+
## Customizing DataReader Behavior
138135

139136
You can use [an Entity Framework 6 IDbCommandInterceptor](https://msdn.microsoft.com/library/dn469464(v=vs.113).aspx) to wrap the `DataReader` instance returned by Npgsql when Entity Framework executes queries. This is possible using a ```DbConfiguration``` class.
140137

docfx.json

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
{
2-
"metadata": [
2+
"metadata":
3+
[
34
{
4-
"src": [
5+
"src":
6+
[
57
{
68
"files": [ "src/Npgsql/Npgsql.csproj" ],
79
"exclude": [ "src/MSI/**", "src/VSIX/**", "**/bin/**", "**/obj/**" ],
810
"src": "Npgsql/"
911
}
1012
],
1113
"dest": "obj/api/Npgsql",
12-
"properties": {
14+
"properties":
15+
{
1316
"TargetFramework": "net8.0"
1417
}
1518
},
1619
{
17-
"src": [
20+
"src":
21+
[
1822
{
1923
"files": [ "src/**/*.csproj" ],
2024
"exclude": [ "**/bin/**", "**/obj/**", "Properties/NpgsqlStrings.*" ],
2125
"src": "EFCore.PG"
2226
}
2327
],
2428
"dest": "obj/api/EFCore.PG",
25-
"properties": {
29+
"properties":
30+
{
2631
"TargetFramework": "net8.0"
2732
}
2833
}
2934
],
30-
"build": {
31-
"template": [
35+
"build":
36+
{
37+
"template":
38+
[
3239
"default",
3340
"modern"
3441
],
35-
"content": [
42+
"content":
43+
[
3644
{
3745
"files": [ "**/*.yml" ],
3846
"src": "obj/api/Npgsql",
@@ -62,7 +70,8 @@
6270
"files": [ "*.md", "dev/**.md", "toc.yml" ]
6371
}
6472
],
65-
"resource": [
73+
"resource":
74+
[
6675
{
6776
"files": [ "img/**", "styles/**", "CNAME" ]
6877
},
@@ -71,6 +80,7 @@
7180
"src": "favicons"
7281
}
7382
],
83+
"output": "_site",
7484
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ],
7585
"globalMetadata": {
7686
"_appTitle": "Npgsql Documentation",
@@ -92,7 +102,6 @@
92102
"branch": "stable"
93103
}
94104
}
95-
},
96-
"dest" : "live"
105+
}
97106
}
98107
}

0 commit comments

Comments
 (0)