Skip to content

Commit

Permalink
Add NuGet package publishing step to RC workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
btungut committed Jan 24, 2025
1 parent e2ddac0 commit 6d9b984
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ on:
- 'README'
- 'README.md'
- 'LICENSE'
# - '.github/**'
- '.github/**'

run-name: ${{ github.ref_name }} - ${{ github.event.head_commit.message }}
run-name: ${{ github.ref_name }} - ${{ github.event.head_commit.message || github.event_name }}


jobs:
Expand All @@ -32,6 +32,7 @@ jobs:
runs-on: ${{ vars.DEFAULT_RUNS_ON }}
env:
DOTNET_VERBOSITY: ${{ inputs.DOTNET_VERBOSITY || 'minimal' }}
NUGET_SOURCE: "https://api.nuget.org/v3/index.json"

steps:
- uses: btungut/devops/.github/actions/common@master
Expand Down Expand Up @@ -100,4 +101,34 @@ jobs:
path: ${{ env.OUTPUT_DIR }}
name: NuGet-${{ env.PACKAGE_VERSION }}
if-no-files-found: error
include-hidden-files: true
include-hidden-files: true

- name: publish_nuget_package
id: publish_nuget_package
shell: bash
run: |
set -euo pipefail
echo "PWD = $(pwd)"
NUGET_API_KEY="${{ secrets.NUGET_API_KEY }}"
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY is null or empty whitespace!"
exit 1
fi
echo -e "\ndotnet nuget push for nupkg\n"
dotnet nuget push \
${{ env.OUTPUT_DIR }}/*.nupkg \
--skip-duplicate \
--api-key "$NUGET_API_KEY" \
--source "$NUGET_SOURCE"
echo -e "\n SUCCESS: dotnet nuget push for nupkg\n\n"
echo -e "\ndotnet nuget push for snupkg\n"
dotnet nuget push \
${{ env.OUTPUT_DIR }}/*.snupkg \
--skip-duplicate \
--api-key "$NUGET_API_KEY" \
--source "$NUGET_SOURCE"
echo -e "\n SUCCESS: dotnet nuget push for snupkg\n\n"

0 comments on commit 6d9b984

Please sign in to comment.