-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6841243
commit 1ab2301
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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: Pack the NuGet package | ||
run: dotnet pack src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --configuration Release --no-build --output ./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 | ||
|
||
- 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 |