Skip to content

Merge pull request #450 from gandalan/12100_FeedbackVerbesserungen #759

Merge pull request #450 from gandalan/12100_FeedbackVerbesserungen

Merge pull request #450 from gandalan/12100_FeedbackVerbesserungen #759

name: Build and publish (NuGet)
on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore:
- 'WebLibs/**'
- '.github/workflows/**'
- '!.github/workflows/build-and-publish.yml'
env:
SDK_VERSION: 8.0.x
PACKAGE_1: GDL.IDAS.Crypto
PACKAGE_1_FULL: Gandalan.IDAS.Crypto
PACKAGE_2: GDL.IDAS.Logging
PACKAGE_2_FULL: Gandalan.IDAS.Logging
PACKAGE_3: GDL.IDAS.WebApi.Client
PACKAGE_3_FULL: Gandalan.IDAS.WebApi.Client
PACKAGE_4: GDL.IDAS.WebApi.Client.Wpf
PACKAGE_4_FULL: Gandalan.IDAS.WebApi.Client.Wpf
PACKAGE_5: GDL.IDAS.Contracts
PACKAGE_5_FULL: Gandalan.IDAS.Contracts
BUILD_CONFIG: Release
OUTPUT_DIR: ./GDLPackages
jobs:
build-and-publish-nuget:
if: github.repository_owner == 'gandalan'
runs-on: ubuntu-22.04 # ubuntu-latest has issue with nuget pack command (nuget: 2: mono: not found)
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Set release_name
id: set_release_name
run: echo "release_name=$(date +'%-Y.%-m.%-d').$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
- name: Setup .NET Core SDK ${{ env.SDK_VERSION }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.SDK_VERSION }}
- name: Run UpdateVersionInfo.ps1 with ${{ steps.set_release_name.outputs.release_name }}
shell: pwsh
run: .\UpdateVersionInfo.ps1 ${{ steps.set_release_name.outputs.release_name }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} --no-restore -p:Version=${{ steps.set_release_name.outputs.release_name }}
- name: Create package ${{ env.PACKAGE_1 }}
run: nuget pack ${{ env.PACKAGE_1_FULL }}/${{ env.PACKAGE_1 }}.nuspec -NonInteractive -Verbosity Detailed -OutputDirectory ${{ env.OUTPUT_DIR }} -Symbols -SymbolPackageFormat snupkg
- name: Create package ${{ env.PACKAGE_2 }}
run: nuget pack ${{ env.PACKAGE_2_FULL }}/${{ env.PACKAGE_2 }}.nuspec -NonInteractive -Verbosity Detailed -OutputDirectory ${{ env.OUTPUT_DIR }} -Symbols -SymbolPackageFormat snupkg
- name: Create package ${{ env.PACKAGE_3 }}
run: nuget pack ${{ env.PACKAGE_3_FULL }}/${{ env.PACKAGE_3 }}.nuspec -NonInteractive -Verbosity Detailed -OutputDirectory ${{ env.OUTPUT_DIR }} -Symbols -SymbolPackageFormat snupkg
- name: Create package ${{ env.PACKAGE_4 }}
run: nuget pack ${{ env.PACKAGE_4_FULL }}/${{ env.PACKAGE_4 }}.nuspec -NonInteractive -Verbosity Detailed -OutputDirectory ${{ env.OUTPUT_DIR }} -Symbols -SymbolPackageFormat snupkg
- name: Create package ${{ env.PACKAGE_5 }}
run: nuget pack ${{ env.PACKAGE_5_FULL }}/${{ env.PACKAGE_5 }}.nuspec -NonInteractive -Verbosity Detailed -OutputDirectory ${{ env.OUTPUT_DIR }} -Symbols -SymbolPackageFormat snupkg
- name: Push packages
run: dotnet nuget push "${{ env.OUTPUT_DIR }}/*.nupkg" -k ${NUGET_TOKEN} #--skip-duplicate
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Create tag
uses: rickstaa/action-create-tag@v1
with:
tag: IDAS.Client.Libs-Release_${{ steps.set_release_name.outputs.release_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release with changelog and assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "IDAS.Client.Libs-Release_${{ steps.set_release_name.outputs.release_name }}" --generate-notes --prerelease ${{ env.OUTPUT_DIR }}/*.nupkg ${{ env.OUTPUT_DIR }}/*.snupkg