From e578a505c90a83cf1ef88430fc4eae623772822c Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Thu, 11 Jan 2024 16:34:05 -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: open-feature/dotnet-sdk#54, open-feature/dotnet-sdk#173 Signed-off-by: Austin Drenski --- .github/workflows/ci.yml | 80 ++++++++++++++++++++++++++++++++ .github/workflows/linux-ci.yml | 34 -------------- .github/workflows/windows-ci.yml | 34 -------------- build/Common.prod.props | 3 ++ build/Common.props | 6 ++- build/Common.tests.props | 2 + 6 files changed, 90 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/linux-ci.yml delete mode 100644 .github/workflows/windows-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..793e0cf2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: CI + +on: + push: + branches: [ main ] + paths-ignore: + - '**.md' + pull_request: + branches: [ main ] + paths-ignore: + - '**.md' + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --logger GitHubActions + + packaging: + needs: build + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - 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/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml deleted file mode 100644 index 7313bea5..00000000 --- a/.github/workflows/linux-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Linux - -on: - push: - branches: [ main ] - paths-ignore: - - '**.md' - pull_request: - branches: [ main ] - paths-ignore: - - '**.md' - -jobs: - build-test: - runs-on: ubuntu-latest - - strategy: - matrix: - version: [net6.0,net7.0] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test ${{ matrix.version }} - run: dotnet test --configuration Release --no-build --logger:"console;verbosity=detailed" diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml deleted file mode 100644 index 3e29f545..00000000 --- a/.github/workflows/windows-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Windows - -on: - push: - branches: [ main ] - paths-ignore: - - '**.md' - pull_request: - branches: [ main ] - paths-ignore: - - '**.md' - -jobs: - build-test: - runs-on: windows-latest - - strategy: - matrix: - version: [net462,net6.0,net7.0] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test ${{ matrix.version }} - run: dotnet test --configuration Release --no-build --logger:"console;verbosity=detailed" diff --git a/build/Common.prod.props b/build/Common.prod.props index 7badf346..ec80de2a 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 fc34c474..928e20d7 100644 --- a/build/Common.props +++ b/build/Common.props @@ -27,4 +27,8 @@ [1.2,) - \ No newline at end of file + + + + + diff --git a/build/Common.tests.props b/build/Common.tests.props index 8a533a23..9f94a8e4 100644 --- a/build/Common.tests.props +++ b/build/Common.tests.props @@ -28,6 +28,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -45,6 +46,7 @@ [4.17.0] [3.1.2] [6.7.0] + [2.3.3] [17.3.2] [5.0.0] [2.4.3,3.0)