-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.72 KB
/
release.yml
File metadata and controls
45 lines (42 loc) · 1.72 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
# 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 nuget package
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history is fetched
- name: Setup .NET env
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore EmailInvoiceExtractor
- name: Install GitVersion
run: |
dotnet tool install --global GitVersion.Tool
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Get Version
run: |
VERSION=$(dotnet-gitversion /showvariable FullSemVer | tr -d '\r')
if [[ -z "$VERSION" ]]; then
echo "❌ ERROR: GitVersion did not return a version!" >&2
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "✅ Set VERSION to $VERSION"
- name: Build
run: dotnet build --no-restore EmailInvoiceExtractor /p:Version=${{ env.VERSION }}
- name: Test
run: dotnet test EmailInvoiceExtractorTests/EmailInvoiceExtractorTests.csproj --configuration Release --no-build --verbosity normal
- name: Create the package
run: |
mkdir -p ./out
dotnet pack --configuration Release ./EmailInvoiceExtractor/EmailInvoiceExtractor.csproj /p:PackageVersion=${{ env.VERSION }} --output ./out
- name: Push generated package to GitHub registry
run: dotnet nuget push ./out/*.nupkg --skip-duplicate --no-symbols --source https://nuget.pkg.github.com/szarlih/index.json --api-key ${{ secrets.EMAILINVOICE_NUGET }}