-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.9 KB
/
Copy pathrelease.yml
File metadata and controls
79 lines (65 loc) · 2.9 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Release
on:
push:
tags:
- "**"
branches-ignore:
- "**"
jobs:
release:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 8.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build Projects
run: dotnet build -c Release --no-restore
- name: Run Tests
run: dotnet test dotnet-eark-sip-tests/dotnet-eark-sip-tests.csproj -c Release --no-build --logger trx
- name: Set NuGet Package Version
shell: pwsh
run: |
$version = "${{ github.ref_name }}"
[xml]$csproj = Get-Content dotnet-eark-sip/dotnet-eark-sip.csproj
$csproj.Project.PropertyGroup[0].Version = $version
$csproj.Save('dotnet-eark-sip/dotnet-eark-sip.csproj')
- name: Pack NuGet Package
run: dotnet pack dotnet-eark-sip/dotnet-eark-sip.csproj -c Release --no-build -o "./dist"
# Validate nuget
- name: Install nuget validator
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
# Validate metadata and content of the NuGet package
# https://www.nuget.org/packages/Meziantou.Framework.NuGetPackageValidation.Tool#readme-body-tab
# If some rules are not applicable, you can disable them
# using the --excluded-rules or --excluded-rule-ids option
- name: Validate package
run: meziantou.validate-nuget-package "dist/dotnet-eark-sip.${{ github.ref_name }}.nupkg"
# Publish to Github Package Registry disabled as we are going to publish to NuGet.org
# - name: Publish to Github Package Registry
# shell: pwsh
# run: dotnet nuget push "dist/dotnet-eark-sip.${{ github.ref_name }}.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source "https://nuget.pkg.github.com/igfej-justica-gov-pt/index.json"
# To publish to nuget.org (public!), would need a key
- name: Publish the package to nuget.org
run: dotnet nuget push "dist/dotnet-eark-sip.${{ github.ref_name }}.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json"
- name: Publish CLI as a ZIP in a draft release
run: |
mkdir "cli_release"
cp -r "dotnet-eark-sip-cli/bin/Release/*" "cli_release/"
Compress-Archive -Path "cli_release/*" -DestinationPath "dist/dotnet-eark-sip-cli.zip"
rm -r "cli_release"
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
name: Version ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
draft: true
files: |
./dist/dotnet-eark-sip.${{ github.ref_name }}.nupkg
./dist/dotnet-eark-sip-cli.zip
env:
GITHUB_TOKEN: ${{ secrets.IGFEJ_DOTNET_EARK_SIP_TOKEN }}