From c8fe68fcd906371ac4af0a83898b5739a93aea15 Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Thu, 11 Jan 2024 16:01:15 -0500 Subject: [PATCH] chore: Add support for GitHub Packages | GITHUB_REF | version format | |---------------|--------------------------------------------------| | refs/heads/* | #.#.#-ci.{%Y%m%d}T{%H%M%S}+sha.${GITHUB_SHA:0:9} | | refs/pull/* | #.#.#-pr.{%Y%m%d}T{%H%M%S}+sha.${GITHUB_SHA:0:9} | | refs/tags/v* | #.#.# | See: #54 Signed-off-by: Austin Drenski --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++++++++- build/Common.prod.props | 3 +++ build/Common.props | 4 ++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51b3f741..a86242b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Run Tests run: dotnet test test/OpenFeature.Tests/ --configuration Release --logger:"console;verbosity=detailed" - + unit-tests-windows: runs-on: windows-latest steps: @@ -44,3 +44,39 @@ jobs: - name: Run Tests run: dotnet test test\OpenFeature.Tests\ --configuration Release --logger:"console;verbosity=detailed" + + packaging: + needs: + - unit-tests-linux + - unit-tests-windows + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + + - name: Restore + run: dotnet restore + + - name: Pack NuGet packages (CI versions) + if: startsWith(github.ref, 'refs/heads/') + run: dotnet pack --no-restore --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" + + - name: Pack NuGet packages (PR versions) + if: startsWith(github.ref, 'refs/pull/') + run: dotnet pack --no-restore --version-suffix "pr.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" + + - name: Pack NuGet packages (Release versions) + if: startsWith(github.ref, 'refs/tags/v') + run: dotnet pack --no-restore + + - name: Publish NuGet packages + if: startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') || startsWith(github.ref, 'refs/tags/v') + run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.NUGET_TOKEN }}" --source https://nuget.pkg.github.com/open-feature/index.json diff --git a/build/Common.prod.props b/build/Common.prod.props index 49e454c5..8fbce04c 100644 --- a/build/Common.prod.props +++ b/build/Common.prod.props @@ -2,7 +2,10 @@ + true + true true + true diff --git a/build/Common.props b/build/Common.props index 4af79a3c..583fb56c 100644 --- a/build/Common.props +++ b/build/Common.props @@ -26,4 +26,8 @@ + + + +