-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (49 loc) · 2.12 KB
/
publish.yml
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
name: Publish NuGet Package
on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
push:
tags:
- 'v*' # This triggers the action when a tag prefixed with 'v' is created
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies for PDNDClientAssertionGenerator
run: dotnet restore src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj
- name: Restore dependencies for PDNDClientAssertionGenerator.Tests
run: dotnet restore src/PDNDClientAssertionGenerator.Tests/PDNDClientAssertionGenerator.Tests.csproj
- name: Build PDNDClientAssertionGenerator
run: dotnet build src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --no-restore --configuration Release
- name: Ensure output directory exists
run: mkdir -p ./output
- name: Pack the NuGet package
run: dotnet pack src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --configuration Release --no-build --output ./output
- name: Debug output directory
run: ls -la ./output
- name: Publish to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./output/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Nuova versione pubblicata: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload NuGet package as release asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./output/*.nupkg
asset_name: package-${{ github.ref_name }}.nupkg
asset_content_type: application/octet-stream