This repository has been archived by the owner on May 9, 2024. It is now read-only.
forked from nor0x/Maui.ColorPicker
-
-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (109 loc) · 4.15 KB
/
ci.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
name: CI
on:
create:
branches:
- release/**
push:
branches:
- master
- dev/**
paths:
- ColorPicker.Maui/**
- ColorPicker.Maui.Tests/**
- .github/workflows/ci.yml
- README.md
- LICENSE.md
pull_request:
branches:
- master
paths:
- ColorPicker.Maui/**
- ColorPicker.Maui.Tests/**
- .github/workflows/ci.yml
- README.md
- LICENSE.md
jobs:
build:
env:
BUILD_CONFIG: 'Release'
# Avoid building the app as building Android and iOS apps in Release mode is expensive.
SOLUTION: 'ColorPicker.Maui.NoApp.sln'
PROJECT_NAME: 'ColorPicker.Maui'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: write # to push to gh-pages branch
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Restore dependencies
run: nuget restore $env:SOLUTION
- name: Setup .NET
run: |
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
./dotnet-install.ps1 -Channel Current
shell: pwsh
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Build
run: msbuild $env:SOLUTION /p:Configuration=$env:BUILD_CONFIG /p:Platform="Any CPU" -p:Version=${{ steps.gitversion.outputs.assemblySemVer }}
- name: Run tests
run: dotnet test $env:SOLUTION /p:Configuration=$env:BUILD_CONFIG /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --no-restore --no-build -l "console;verbosity=detailed"
- name: Download live-documenter
uses: robinraju/[email protected]
with:
repository: "barry-jones/live-documenter"
latest: true
fileName: "livedocumenter*.zip"
tarBall: false
zipBall: false
- name: Install live-documenter
run: |
Expand-Archive -Path livedocumenter*.zip -DestinationPath build/livedocumenter
shell: pwsh
- name: Generate documentation
run: |
# Avoid generating using the Android library as it has a lot of generated "Resources" code.
# We'll explicitly select the Windows target.
$dllName = (Get-ChildItem -Path ${{ env.PROJECT_NAME }}/bin/${{ env.BUILD_CONFIG }}/net*-windows*/ -Filter ${{ env.PROJECT_NAME }}.dll -Recurse | Select-Object -First 1 -ExpandProperty FullName)
./build/livedocumenter/exporter/net471/exporter $dllName -to ./build/docs -format web-refresh.ldec
mv "./build/docs/LD Export*" "./build/docs/web"
shell: pwsh
- name: Deploy documentation to GitHub pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/docs/web
- name: Publish documentation artifacts
uses: actions/upload-artifact@v2
with:
name: docs.${{ steps.gitversion.outputs.semVer }}
path: ./build/docs/web/**
- name: Build nuget packages
run: msbuild -t:pack $env:SOLUTION -p:Configuration=$env:BUILD_CONFIG -p:PackageVersion=${{ steps.gitversion.outputs.semVer }}
- name: Move nuget packages
run: mkdir .nupkgs; get-childitem *.*nupkg -recurse | foreach-object {move-item $_ -destination .nupkgs}
shell: pwsh
- name: Publish nuget artifacts
uses: actions/upload-artifact@v2
with:
name: packages.${{ steps.gitversion.outputs.semVer }}
path: .nupkgs/**
- name: Publish dev
if: github.ref == 'refs/heads/master'
run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
- name: Publish
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}