Skip to content

Commit 0d3c60e

Browse files
committed
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 <[email protected]>
1 parent 20aeb3a commit 0d3c60e

File tree

6 files changed

+94
-69
lines changed

6 files changed

+94
-69
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- '**.md'
8+
pull_request:
9+
branches: [ main ]
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
os: [ ubuntu-latest, windows-latest ]
18+
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
submodules: recursive
27+
28+
- name: Setup .NET SDK
29+
uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: |
32+
6.0.x
33+
7.0.x
34+
35+
- name: Restore
36+
run: dotnet restore
37+
38+
- name: Build
39+
run: dotnet build --no-restore
40+
41+
- name: Test
42+
run: dotnet test --no-build --logger GitHubActions
43+
44+
packaging:
45+
needs: build
46+
47+
permissions:
48+
contents: read
49+
packages: write
50+
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
submodules: recursive
59+
60+
- name: Setup .NET SDK
61+
uses: actions/setup-dotnet@v4
62+
with:
63+
dotnet-version: |
64+
6.0.x
65+
7.0.x
66+
67+
- name: Restore
68+
run: dotnet restore
69+
70+
- name: Pack NuGet packages (CI versions)
71+
if: startsWith(github.ref, 'refs/heads/')
72+
run: dotnet pack --no-restore --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}"
73+
74+
- name: Pack NuGet packages (PR versions)
75+
if: startsWith(github.ref, 'refs/pull/')
76+
run: dotnet pack --no-restore --version-suffix "pr.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}"
77+
78+
- name: Pack NuGet packages (Release versions)
79+
if: startsWith(github.ref, 'refs/tags/v')
80+
run: dotnet pack --no-restore
81+
82+
- name: Publish NuGet packages
83+
if: startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') || startsWith(github.ref, 'refs/tags/v')
84+
run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/open-feature/index.json

.github/workflows/linux-ci.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/windows-ci.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

build/Common.prod.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<Import Project=".\Common.props" />
33

44
<PropertyGroup>
5+
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
6+
<Deterministic Condition="'$(CI)' == 'true'">true</Deterministic>
57
<GenerateDocumentationFile>true</GenerateDocumentationFile>
8+
<PackRelease>true</PackRelease>
69
</PropertyGroup>
710

811
<PropertyGroup>

build/Common.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@
2727
<!-- 0.5+ -->
2828
<OpenFeatureVer>[1.2,)</OpenFeatureVer>
2929
</PropertyGroup>
30-
</Project>
30+
31+
<ItemGroup Condition="'$(OS)' == 'Unix'">
32+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
33+
</ItemGroup>
34+
</Project>

build/Common.tests.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2929
</PackageReference>
3030
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVer)" />
31+
<PackageReference Include="GitHubActionsTestLogger" Version="$(GitHubActionsTestLoggerVer)" />
3132
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPkgVer)" />
3233
<PackageReference Include="NSubstitute" Version="$(NSubstituteVer)" />
3334
<PackageReference Include="xunit" Version="$(XUnitPkgVer)" />
@@ -45,6 +46,7 @@
4546
<AutoFixtureVer>[4.17.0]</AutoFixtureVer>
4647
<CoverletCollectorVer>[3.1.2]</CoverletCollectorVer>
4748
<FluentAssertionsVer>[6.7.0]</FluentAssertionsVer>
49+
<GitHubActionsTestLoggerVer>[2.3.3]</GitHubActionsTestLoggerVer>
4850
<MicrosoftNETTestSdkPkgVer>[17.3.2]</MicrosoftNETTestSdkPkgVer>
4951
<NSubstituteVer>[5.0.0]</NSubstituteVer>
5052
<XUnitRunnerVisualStudioPkgVer>[2.4.3,3.0)</XUnitRunnerVisualStudioPkgVer>

0 commit comments

Comments
 (0)