From 26cd5cdd613577c53ae79b889d1cf2d89262236f Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Fri, 19 Jan 2024 18:25:38 -0500 Subject: [PATCH] chore: Add support for GitHub Packages (#173) Signed-off-by: Austin Drenski --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ build/Common.prod.props | 12 ++++------- build/Common.props | 4 ++++ 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9ff3649..ca5f5083 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,46 @@ jobs: - name: Run Tests run: dotnet test test\OpenFeature.Tests\ --configuration Release --logger GitHubActions + + packaging: + needs: + - unit-tests-linux + - unit-tests-windows + + permissions: + contents: read + packages: write + + 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: Publish NuGet packages (base) + if: github.event.pull_request.head.repo.fork == false + run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/open-feature/index.json + + - name: Publish NuGet packages (fork) + if: github.event.pull_request.head.repo.fork == true + uses: actions/upload-artifact@v4.2.0 + with: + name: nupkgs + path: src/**/*.nupkg diff --git a/build/Common.prod.props b/build/Common.prod.props index 63a52d44..4d073ecf 100644 --- a/build/Common.prod.props +++ b/build/Common.prod.props @@ -2,7 +2,10 @@ + true + true true + true @@ -16,7 +19,7 @@ Apache-2.0 OpenFeature Authors true - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) @@ -32,11 +35,4 @@ snupkg - - - - - - true - diff --git a/build/Common.props b/build/Common.props index c33ed3ec..43424f59 100644 --- a/build/Common.props +++ b/build/Common.props @@ -28,4 +28,8 @@ + + + +