Skip to content

Commit

Permalink
Create cd-production.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
neoscie authored Dec 5, 2024
1 parent bd08303 commit e1a1e40
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/cd-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish NuGet package

on:
release:
types: [published]

env:
ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json
PROJECT_NAME: "Neolution.DotNet.Console"
BUILD_CONFIGURATION: "Release"
DOTNET_VERSION: "8.x"

jobs:
build-pack-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: ${{ env.ARTIFACTS_FEED_URL }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}

- name: Determine version for NuGet package
run: echo "NUGET_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Build and pack
run: |
dotnet restore
dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} -p:Version=$NUGET_VERSION
dotnet pack "${{ env.PROJECT_NAME }}\${{ env.PROJECT_NAME }}.csproj" --configuration ${{ env.BUILD_CONFIGURATION }} --no-build -p:PackageVersion=$NUGET_VERSION
- name: Push NuGet package
run: dotnet nuget push --skip-duplicate -k $NUGET_AUTH_TOKEN **/bin/${{ env.BUILD_CONFIGURATION }}/*.nupkg
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}

0 comments on commit e1a1e40

Please sign in to comment.