From 216f7355e3cee10e99a200fc1ba404944bb8e1c4 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 ++++ nuget.config | 20 ++++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 nuget.config diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51b3f741..aad55b31 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 "${GITHUB_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 @@ + + + + diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..e06eff45 --- /dev/null +++ b/nuget.config @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + +