-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (138 loc) · 5.04 KB
/
build.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
name: build
on: [push, pull_request]
jobs:
core-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- uses: paulhatch/[email protected]
id: semantic_version
with:
tag_prefix: "v"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: dotnet restore
- name: Build Core
run: dotnet build --configuration Release --no-restore PictSharp.Core -o ./bin
- name: Build ImageSharp
run: dotnet build --configuration Release --no-restore PictSharp.ImageSharpAdaptor -o ./bin /p:Version=${{ steps.semantic_version.outputs.VERSION }}
- name: Pack Core
run: dotnet pack --configuration Release --no-restore PictSharp.Core -o ./nupkgs /p:Version=${{ steps.semantic_version.outputs.VERSION }}
- name: Pack ImageSharpAdaptor
run: dotnet pack --configuration Release --no-restore PictSharp.ImageSharpAdaptor -o ./nupkgs /p:Version=${{ steps.semantic_version.outputs.VERSION }}
- name: Upload Compiled Binaries
uses: actions/upload-artifact@v2
with:
name: dotnetcore-bin
path: bin/
- name: Upload PictSharp.Core Package
uses: actions/upload-artifact@v2
with:
name: PictSharp.Core.nupkg
path: nupkgs/PictSharp.Core.*
- name: Upload PictSharp.ImageSharpAdaptor Package
uses: actions/upload-artifact@v2
with:
name: PictSharp.ImageSharpAdaptor.nupkg
path: nupkgs/PictSharp.ImageSharpAdaptor.*
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: paulhatch/[email protected]
id: semantic_version
with:
tag_prefix: "v"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET Core SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Restore NuGet Packages
run: nuget restore PictSharp.sln
- name: Build PictSharp.Drawing
run: msbuild .\PictSharp.Drawing\PictSharp.Drawing.csproj /p:Configuration=Release /p:OutputPath=..\bin
- name: Package
run: msbuild -t:pack /p:Configuration=Release /p:PackageOutputPath=..\nupkgs .\PictSharp.Drawing\PictSharp.Drawing.csproj /p:Version=${{ steps.semantic_version.outputs.VERSION }}
- name: Upload Compiled
uses: actions/upload-artifact@v2
with:
name: dotnet-4-7-2-bin
path: bin\*
- name: Upload Packages
uses: actions/upload-artifact@v2
with:
name: PictSharp.Drawing.nupkg
path: .\nupkgs\*
test:
needs: [core-build, windows-build]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Setup .NET Core SDK 3.1
uses: actions/[email protected]
with:
dotnet-version: 3.1.x
- name: Setup .NET Core SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Install dependencies
run: dotnet restore
- name: Test
run: dotnet test PictSharp.Tests --no-restore --logger GitHubActions
publish:
needs: [test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Verify commit exists in origin/master
run: git branch --remote --contains | grep origin/master
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Download PictSharp.Core.nupkg
uses: actions/download-artifact@v2
with:
name: 'PictSharp.Core.nupkg'
path: ./nupkgs
- name: Download PictSharp.ImageSharpAdaptor.nupkg Package
uses: actions/download-artifact@v2
with:
name: 'PictSharp.ImageSharpAdaptor.nupkg'
path: ./nupkgs
- name: Download PictSharp.Drawing.nupkg
uses: actions/download-artifact@v2
with:
name: 'PictSharp.Drawing.nupkg'
path: ./nupkgs
- name: Setup .NET Core SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Push to Github Repository
run: dotnet nuget push ./nupkgs/*.nupkg --source https://nuget.pkg.github.com/pgodwin/index.json --api-key ${GITHUB_TOKEN} --skip-duplicate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the package to nuget.org
run: dotnet nuget push ./nupkgs/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}