Skip to content

Commit

Permalink
docs: add script to Generate and Publish APIs into GitHub Pages (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored Jun 25, 2021
1 parent 589c275 commit 4b8c30e
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ This release introduces a support for new InfluxDB OSS API definitions - [oss.ym
- NodaTime.Serialization.JsonNet to 3.0.0
- Microsoft.Extensions.ObjectPool to 5.0.7

### Documentation
1. [#213](https://github.com/influxdata/influxdb-client-csharp/pull/213): API documentation is deploy to [GitHub Pages](https://influxdata.github.io/influxdb-client-csharp/api/InfluxDB.Client.html)

## 1.19.0 [2021-06-04]

### Features
Expand Down
33 changes: 33 additions & 0 deletions Scripts/generate-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

#
# Generate API documentation via docFx
#
# How to run in Docker:
#
# docker run --rm -it \
# -v /usr/local/share/dotnet/sdk/NuGetFallbackFolder:/usr/local/share/dotnet/sdk/NuGetFallbackFolder \
# -v "${PWD}":/code \
# -w /code \
# tsgkadot/docker-docfx:latest /code/Scripts/generate-docs.sh
#
# How to check generated site:
#
# cd docfx_project/_site
# docker run -it --rm -p 8080:80 --name web -v $PWD:/usr/share/nginx/html nginx
#

SCRIPT_PATH="$( cd "$(dirname "$0")" || exit ; pwd -P )"

#
# Remove old docs
#
rm -rf "${SCRIPT_PATH}"/../docfx_project/api || true
rm -rf "${SCRIPT_PATH}"/../docfx_project/_site || true

#
# Build docs
#
cd "${SCRIPT_PATH}"/../docfx_project || exit
docfx metadata
docfx build
45 changes: 45 additions & 0 deletions Scripts/publish-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

#
# Publish site to GitHub Pages
#
# How to run in Docker:
#
# docker run --rm -it \
# -v "${PWD}/docfx_project":/code/docfx_project \
# -v "${PWD}/Scripts":/code/Scripts \
# -v "${PWD}/.circleci":/code/.circleci \
# -v ~/.ssh:/root/.ssh \
# -v ~/.gitconfig:/root/.gitconfig \
# -w /code \
# ubuntu /code/Scripts/publish-site.sh
#

set -e

SCRIPT_PATH="$( cd "$(dirname "$0")" || exit ; pwd -P )"
cd "$SCRIPT_PATH"/..

echo "# Install Git"
apt-get update \
&& apt-get install git --yes \

echo "# Clone client and switch to branch for GH-Pages"
git clone [email protected]:influxdata/influxdb-client-csharp.git \
&& cd influxdb-client-csharp \
&& git switch -C gh-pages

echo "# Remove old pages"
rm -r "$SCRIPT_PATH"/../influxdb-client-csharp/*

echo "# Copy new docs"
cp -Rf "$SCRIPT_PATH"/../docfx_project/_site/* "$SCRIPT_PATH"/../influxdb-client-csharp/

echo "# Copy CircleCI"
cp -R "${SCRIPT_PATH}"/../.circleci/ "$SCRIPT_PATH"/../influxdb-client-csharp/

echo "# Deploy site"
cd "$SCRIPT_PATH"/../influxdb-client-csharp
git add -f .
git commit -m "Pushed the latest Docs to GitHub pages [skip CI]"
git push -fq origin gh-pages
10 changes: 10 additions & 0 deletions docfx_project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
###############
# folder #
###############
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/
/**/obj/
_site
api
73 changes: 73 additions & 0 deletions docfx_project/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"metadata": [
{
"src": [
{
"files": [
"**/Client.Core/**.csproj",
"**/Client/**.csproj",
"**/Client.Legacy/**.csproj",
"**/Client.Linq/**.csproj"
],
"src": ".."
}
],
"dest": "api",
"filter": "filterConfig.yml",
"disableGitFeatures": false,
"properties": {
"TargetFramework": "netstandard2.1"
}
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**",
"favicon.ico"
]
}
],
"overwrite": [
{
"files": [
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"statictoc"
],
"globalMetadata": {
"_appLogoPath": "images/influxdata-logo--symbol--white.png",
"_disableContribution": true
},
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
Binary file added docfx_project/favicon.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions docfx_project/filterConfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiRules:
- exclude:
uidRegex: ^InfluxDB\.Client\.Api\.Client$
type: Namespace
- exclude:
uidRegex: ^InfluxDB\.Client\.Configurations$
type: Namespace
- exclude:
uidRegex: ^InfluxDB\.Client\.Core\.Internal$
type: Namespace
- exclude:
uidRegex: ^InfluxDB\.Client\.Core\.Flux\.Internal$
type: Namespace
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docfx_project/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# influxdb-client-csharp

| Client | Description | API |
| --- | --- | --- |
| `Client` | The reference C# client that allows query, write and InfluxDB 2.0 management. | [InfluxDB.Client.html](api/InfluxDB.Client.yml)|
| `Client.Linq` | The library supports to use a LINQ expression to query the InfluxDB. | [InfluxDB.Client.Linq.html](api/InfluxDB.Client.Linq.yml) |
| `Client.Legacy` | The reference C# client that allows you to perform Flux queries against InfluxDB 1.7+. | [InfluxDB.Client.Flux.html](api/InfluxDB.Client.Flux.yml) |
3 changes: 3 additions & 0 deletions docfx_project/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: InfluxDB.Client API
href: api/
homepage: api/InfluxDB.Client.yml

0 comments on commit 4b8c30e

Please sign in to comment.