-
Notifications
You must be signed in to change notification settings - Fork 63
119 lines (98 loc) · 3.07 KB
/
netcore-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
name: EasyData.NET Pipeline
on:
workflow_dispatch:
inputs:
release_mode:
description: 'Release mode (none, dev, prod)'
required: true
default: 'none'
release:
types: [published]
push:
branches:
- master
paths:
- .github/workflows/netcore-build.yml
- easydata.net/**
pull_request:
branches:
- master
- dev
paths:
- .github/workflows/netcore-build.yml
- easydata.net/**
jobs:
build_and_test:
name: Build & Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Setup .NET 5
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.0.x'
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.x'
- name: Read version.json to env
uses: antifree/json-to-variables@v1.0.0
with:
filename: ./easydata.net/version.json
prefix: ed
- name: Setup version in Build.props
run: ./tools/SetVersionInCsproj.ps1 ./easydata.net/src/Directory.Build.props ${{ env.ed_packageVersion }} ${{ env.ed_assemblyVersion }}
shell: powershell
- name: Install dependencies
run: dotnet restore EasyData.Dev.sln
- name: Build & Pack
run: dotnet pack EasyData.sln -o ./easydata.net/packs --configuration Release --no-restore
- name: Test
run: dotnet test EasyData.Dev.sln --no-restore --verbosity minimal
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: packs
path: ./easydata.net/packs/**/*.nupkg
release_dev:
name: Development Release
needs: [ build_and_test ]
if: github.event.inputs.release_mode == 'dev' && needs.build_and_test.result == 'success'
runs-on: windows-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packs
path: packs
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Publish packages to MyGet
run: dotnet nuget push packs/**/*.nupkg -s https://www.myget.org/F/korzh-nuget/api/v2/package -k ${{ secrets.MYGET_ACCESS_TOKEN }}
release_prod:
name: Production Release
needs: [ build_and_test ]
if: (github.event.inputs.release_mode == 'prod' || github.event_name == 'release') && needs.build_and_test.result == 'success'
runs-on: windows-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: packs
path: packs
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Publish packages to NuGet
run: dotnet nuget push packs/**/*.nupkg -s 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGET_ACCESS_TOKEN }} --skip-duplicate