-
Notifications
You must be signed in to change notification settings - Fork 118
58 lines (47 loc) · 1.7 KB
/
dotnetcore.yml
File metadata and controls
58 lines (47 loc) · 1.7 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
name: .NET Core build
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6.0.2
- name: Setup .NET Core
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: 10.0.x
- name: Install dependencies
working-directory: ./PreMailer.Net
run: dotnet restore
- name: Build
working-directory: ./PreMailer.Net
run: dotnet build --configuration Release --no-restore
- name: Test
working-directory: ./PreMailer.Net
run: dotnet test --no-restore --verbosity normal --collect "Code coverage"
- name: Extract version from tag
if: ${{ github.event_name == 'release' }}
id: version
run: |
$tag = "${{ github.event.release.tag_name }}"
$version = $tag -replace '^v', ''
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Write release notes to file
if: ${{ github.event_name == 'release' }}
run: |
"${{ github.event.release.body }}" | Out-File -FilePath release-notes.txt -Encoding utf8
- name: Package
if: ${{ github.event_name == 'release' }}
run: |
$releaseNotes = Get-Content release-notes.txt -Raw
dotnet pack -c Release -o . PreMailer.Net/PreMailer.Net/PreMailer.Net.csproj `
-p:Version="${{ steps.version.outputs.version }}" `
-p:PackageReleaseNotes="$releaseNotes"
- name: Publish
if: ${{ github.event_name == 'release' }}
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_APIKEY }} -s https://api.nuget.org/v3/index.json