From 03799f9c86f0fc3fbe076fb329122554b676147f Mon Sep 17 00:00:00 2001 From: prasenjeetnath <147582543+prasenjeetnath@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:29:55 +0530 Subject: [PATCH] Create release.yml --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d722218 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Publish NuGet Packages + +on: + release: + types: [published] + +permissions: + packages: write + contents: read + +jobs: + build: + runs-on: windows-latest + + defaults: + run: + working-directory: . + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download NuGet Packages from Release + run: | + Write-Host "GITHUB_REF: '$($env:GITHUB_REF)'" + $prefix = "refs/tags/" + $name = $($env:GITHUB_REF).Substring($prefix.Length) + Write-Host "name: '$name'" + gh release download $name --repo siemens/continuous-clearing --pattern '*.nupkg' --clobber + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to github packages + run: | + dotnet nuget add source --username ${{ secrets.USERNAME }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://www.nuget.org" + dotnet nuget push "*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source github + env: + USERNAME: ${{ secrets.USERNAME }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}