From ecac056ce8b372ab618983eaf3179735606912f0 Mon Sep 17 00:00:00 2001 From: Oleksandr Petreniuk Date: Mon, 11 Dec 2023 17:10:37 +0200 Subject: [PATCH] Added build dlls and push to packages --- .github/workflows/build_dlls.yml | 46 +++++++++++++++++++ ...stledice-riptide-message-extensions.csproj | 12 ++--- 2 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build_dlls.yml diff --git a/.github/workflows/build_dlls.yml b/.github/workflows/build_dlls.yml new file mode 100644 index 0000000..16b2ec5 --- /dev/null +++ b/.github/workflows/build_dlls.yml @@ -0,0 +1,46 @@ +name: Build and Publish DLLs + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build_and_publish: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.sha }} + + - name: Extract version digits from tag + id: extract_version + run: | + $TAG="${{ github.ref_name }}" + if (-not ($TAG -match '^v\d+\.\d+\.\d+.*?$')) { + echo "Invalid tag format: $TAG" + exit 1 + } + $version=$TAG.Substring(1) + echo "VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + + - name: Install .NET Core SDK + uses: actions/setup-dotnet@v2 + with: + dotnet-version: '8.0' + + - name: Restore NuGet packages + run: | + dotnet nuget add source --username Lackronik --password ${{ secrets.GH_PAT_PACK }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + dotnet restore .\castledice-riptide-message-extensions\castledice-riptide-message-extensions.csproj + + - name: Build DLLs + run: dotnet build -c Release + + - name: Pack NuGet package + run: dotnet pack .\castledice-riptide-message-extensions\castledice-riptide-message-extensions.csproj -c Release /p:PackageVersion=${{ env.VERSION }} + + - name: Publish DLLs to GitHub Packages + run: dotnet nuget push D:\a\castledice-riptide-message-extensions\castledice-riptide-message-extensions\castledice-riptide-message-extensions\bin\Release\castledice-riptide-message-extensions.${{ env.VERSION }}.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GH_PAT_PACK }} diff --git a/castledice-riptide-message-extensions/castledice-riptide-message-extensions.csproj b/castledice-riptide-message-extensions/castledice-riptide-message-extensions.csproj index d280e13..62056df 100644 --- a/castledice-riptide-message-extensions/castledice-riptide-message-extensions.csproj +++ b/castledice-riptide-message-extensions/castledice-riptide-message-extensions.csproj @@ -13,15 +13,9 @@ - - ..\..\casltedice-events-logic\casltedice-events-logic\bin\Debug\netstandard2.1\casltedice-events-logic.dll - - - ..\..\castledice-game-data-logic\castledice-game-data-logic\bin\Debug\netstandard2.1\castledice-game-data-logic.dll - - - ..\..\castledice-game-logic\castledice-game-logic\bin\Debug\netstandard2.1\castledice-game-logic.dll - + + +