v1.7.15 AsNumbers #102
Workflow file for this run
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 | |
on: | |
push: | |
# branches: | |
# - main | |
tags: | |
- 'v*' | |
# release: | |
# types: [created] | |
# workflow_dispatch is used to manually invoke the GH action | |
workflow_dispatch: | |
env: | |
# Setting the required env flags | |
package_name: Smab.Helpers | |
csproj: src/Smab.Helpers/Smab.Helpers.csproj | |
config: Release | |
dotnet_core_version: 9.0.* | |
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 format style | |
- name: dotnet Format Style | |
run: dotnet format style --verify-no-changes --verbosity diagnostic | |
# Run dotnet build | |
- name: dotnet Build | |
run: dotnet build --configuration ${{ env.config }} | |
shell: bash | |
# Run dotnet publish | |
- name: dotnet Publish | |
run: dotnet publish ${{ env.csproj }} --configuration ${{ env.config }} | |
shell: bash | |
# Run dotnet pack to create the nupkg file for the project and store in artifacts folder | |
- name: Run Pack | |
run: dotnet pack ${{ env.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 |