-
-
Notifications
You must be signed in to change notification settings - Fork 77
154 lines (130 loc) · 4.58 KB
/
main.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: MegaApiClient CI
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
workflow_dispatch:
env:
CONFIGURATION: Release
jobs:
build:
name: Build and Pack ⚙️📦
runs-on: windows-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history is required by GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
updateAssemblyInfo: true
updateAssemblyInfoFilename: './GlobalAssemblyInfo.cs'
- name: Build
run: dotnet build --configuration ${{ env.CONFIGURATION }} ./MegaApiClient/
- name: Create NuGet package
run: dotnet pack --configuration ${{ env.CONFIGURATION }} ./MegaApiClient/ --no-restore --no-build --output ./artifacts/ -p:PackageVersion=${{ env.GITVERSION_NUGETVERSION }}
- name: Upload NuGet packages
uses: actions/upload-artifact@v3
with:
name: NuGet packages
path: ./artifacts/*.*nupkg
if-no-files-found: error
test:
name: Test 🧪
if: ${{ false }} # Disable tests for now
timeout-minutes: 60
runs-on: windows-latest
steps:
- name: Concurrent test execution check
uses: softprops/turnstyle@v1
with:
same-branch-only: false
abort-after-seconds: 1800
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repository code
uses: actions/checkout@v3
- name: Tests
run: dotnet test --configuration ${{ env.CONFIGURATION }} ./MegaApiClient.Tests/ --framework net60 --logger "console;verbosity=detailed" --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Exclude="[MegaApiClient]BigInteger"
env:
MEGAAPICLIENT_PASSWORD: ${{ secrets.MEGAAPICLIENT_PASSWORD }}
- name: Codecov
uses: codecov/codecov-action@v2
doc:
name: Documentation 📚
needs: [ build ]
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install DocFX
run: nuget install docfx.console -Version 2.58.9
- name: Build documentation
run: |
./docfx.console.2.58.9/tools/docfx.exe metadata ./docs/docfx.json
./docfx.console.2.58.9/tools/docfx.exe build ./docs/docfx.json --globalMetadata "{'_appFooter': 'Copyright © 2013-2024 - Gregoire Pailler - MegaApiClient ${{ needs.build.outputs.semVer }}'}"
- name: Upload Documentation
uses: actions/upload-artifact@v3
with:
name: Documentation
path: ./docs/_site/
if-no-files-found: error
deploy:
name: Deploy 🚀
needs: [ build, doc ]
runs-on: windows-latest
steps:
- name: Download NuGet packages
uses: actions/download-artifact@v3
with:
name: NuGet packages
path: ./artifacts/
- name: Publish on MyGet
run: |
cd ./artifacts/
dotnet nuget push *.nupkg --source https://www.myget.org/F/megaapiclient/api/v3/index.json --api-key ${{ secrets.MYGET_SECRET }}
deploy-release:
name: Deploy release 🚀🌐
needs: [ build, doc ]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download NuGet packages
uses: actions/download-artifact@v2
with:
name: NuGet packages
path: ./artifacts/
- name: Download Documentation
uses: actions/download-artifact@v2
with:
name: Documentation
path: ./docs/_site/
- name: Publish Documentation
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ./docs/_site/
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./artifacts/*.nupkg
draft: true
- name: Publish on NuGet
run: |
cd ./artifacts/
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_SECRET }}