-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (32 loc) · 1.21 KB
/
main.yml
File metadata and controls
42 lines (32 loc) · 1.21 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
name: Publish NuGet Package
on: [workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # Change this to your required .NET version
- name: Restore dependencies
run: dotnet restore
- name: Build the project
run: dotnet build --configuration Release
- name: Pack the project
run: dotnet pack --configuration Release --output ./nupkgs
- name: Exclude unwanted packages
run: |
# Exclude packages that don't start with "Hexa.NET."
for package in ./nupkgs/*.nupkg; do
package_name=$(basename "$package")
if [[ ! $package_name == Hexa.NET* ]]; then
echo "Removing $package_name as it does not start with Hexa.NET."
rm -f "$package"
fi
done
- name: List packages
run: ls ./nupkgs/
- name: Publish the package
run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json