-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (87 loc) · 3.08 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Deploy
on:
push:
branches:
- "master"
jobs:
# Creates the .nupkg with dotnet pack and uploads it as an artifact
create_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Create NuGet package
run: dotnet pack src/Apod/Apod.csproj -c Release --output nupkgs
- name: Upload package artifact
uses: actions/upload-artifact@v1
with:
name: nupkg
path: nupkgs
# Pushes the .nupkg to NuGet.org
push_nuget:
needs: create_package
runs-on: ubuntu-latest
steps:
- name: Download package artifact
uses: actions/download-artifact@v1
with:
name: nupkg
# Required for the --skip-duplicate parameter
- name: Install .NET Core v3.1 SDK
uses: actions/setup-dotnet@v1.0.0
with:
version: '3.1.100'
- name: Push package to NuGet.org
run: dotnet nuget push nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
# Pushes the .nupkg to Github Package Registry
push_gpr:
needs: create_package
runs-on: windows-latest # See https://github.com/NuGet/Home/issues/8580 (remember to change backslash to normal slash if changing back)
steps:
- name: Download package artifact
uses: actions/download-artifact@v1
with:
name: nupkg
- uses: NuGet/setup-nuget@v1.0.2
with:
nuget-version: 'latest'
- name: Push package to the Github Package Registry
run: |
nuget sources Add -Name "GPR" -Source "https://nuget.pkg.github.com/lemorrow/index.json" -UserName LeMorrow -Password ${{ secrets.GITHUB_TOKEN }}
nuget push nupkg\*.nupkg -Source "GPR" -SkipDuplicate -NoSymbols -Verbosity detailed
# Generates the documentation with DocFX and uploads the static website as an artifact
generate_docs:
runs-on: windows-latest # On windows because DocFX was difficult to install on other machines
steps:
- uses: actions/checkout@v1
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: 'latest'
- name: Install DocFX
run: nuget install docfx.console -Version 2.47.0
- name: Generate site with DocFX
run: |
docfx.console.2.47.0\tools\docfx.exe metadata docs/docfx.json
docfx.console.2.47.0\tools\docfx.exe build docs/docfx.json
- name: Upload site artifact
uses: actions/upload-artifact@v1
with:
name: site
path: docs/_site
# Publishes the documentation website to the gh-pages branch
deploy_docs:
needs: generate_docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download site artifact
uses: actions/download-artifact@v1
with:
name: site
- name: Deploy site to gh-pages branch
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: site