-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (46 loc) · 2.28 KB
/
Copy pathdotnet.yml
File metadata and controls
52 lines (46 loc) · 2.28 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main", "master", "develop", "feature/*", "release/*", "hotfix/*", "support/*" ]
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
build:
# strategy:
# matrix:
# runner: [ ubuntu-latest, self-hosted ]
# runs-on: ${{ matrix.runner }}
# disabled ubuntu-latest runner because .NET Framework 4.x might have problem running
# runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v6.0.0
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5.0.0
with:
dotnet-version: 10.0.x
- name: Install GitVersion
run: dotnet tool restore
- name: Restore dependencies
run: dotnet restore ./src/EasyConsoleApplication.sln
- name: Determine version
run: dotnet tool run dotnet-gitversion /updateprojectfiles
- name: Build
run: dotnet build ./src/EasyConsoleApplication.sln --configuration Release --no-restore -p:ContinuousIntegrationBuild=True
#- name: Test
# run: dotnet test ./src/EasyConsoleApplication.sln --configuration Release --no-build --verbosity normal
- name: Pack
# only pack if the branch is main, release, or hotfix
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/')
run: dotnet pack ./src/EasyConsoleApplication.sln --configuration Release --no-build --output ./artifacts --include-symbols
- name: Publish
# only publish if the branch is main, release or hotfix
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/')
# with windows-latest, the path is D:\a\EasyConsoleApplication\EasyConsoleApplication\artifacts\*.nupkg
# with ubuntu-latest, the path is ./artifacts/*.nupkg
run: dotnet nuget push 'D:\a\EasyConsoleApplication\EasyConsoleApplication\artifacts\*.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}