v1.3.13 tiny update #49
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
name: NuGet Publish | |
# workflow_dispatch is used to manually invoke the GH action | |
on: | |
push: | |
branches: | |
- main | |
env: | |
# Setting the required env flags | |
package_name: Smab.Helpers | |
dotnet_core_version: 8.0.x | |
config: Release | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
jobs: | |
publish_job: | |
# CI running on linux | |
runs-on: ubuntu-latest | |
steps: | |
# This step clones the source code to the CI build machine | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# This step installs the .NET SDK | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.dotnet_core_version }} | |
# Run dotnet pack to create the nupkg file for the project and store in artifacts folder | |
- name: Run Pack | |
run: dotnet pack src/${{ env.package_name }}/${{ env.package_name }}.csproj -o ./artifacts --configuration ${{ env.config }} | |
shell: bash | |
# Find all the created nupkg files and publish it to NuGet, | |
# we use the wonderful swiss-army knife capability `find -exec` to find and then execute an action on it. | |
# NUGET_DEPLOY_KEY is the NuGet API key stored in the repo GH action secrets | |
# If you also publish symbol packages, find the snupkg files and publish it to NuGet | |
- name: Publish ${{ env.package_name }} to NuGet | |
run: | | |
find . -name '*.nupkg' -exec dotnet nuget push "{}" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }} --skip-duplicate \; | |
find . -name '*.snupkg' -exec dotnet nuget push "{}" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }} \; | |
shell: bash |