forked from TestableIO/System.IO.Abstractions
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (80 loc) · 2.44 KB
/
ci.yml
File metadata and controls
80 lines (80 loc) · 2.44 KB
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
name: Continuous Integration
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install .NET Core 2.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.1.x"
- name: Install .NET Core 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Merge installed .NET SDKs
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}
- name: Run tests
run: dotnet test --verbosity normal
pack:
name: Pack
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install .NET Core 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Create packages
run: dotnet pack --configuration Release --output ./packages
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: NuGet packages
path: packages/*.*
deploy:
name: Deploy
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: [pack]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: NuGet packages
path: packages
- name: Push packages
run: dotnet nuget push packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- uses: dotnet/nbgv@v0.3.1
id: nbgv
- name: Create GitHub release
uses: actions/create-release@v1
with:
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
release_name: v${{ steps.nbgv.outputs.SemVer2 }}