Skip to content

Commit 26cd5cd

Browse files
chore: Add support for GitHub Packages (#173)
Signed-off-by: Austin Drenski <[email protected]>
1 parent f47cf07 commit 26cd5cd

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

.github/workflows/ci.yml

+43
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,46 @@ jobs:
4444
4545
- name: Run Tests
4646
run: dotnet test test\OpenFeature.Tests\ --configuration Release --logger GitHubActions
47+
48+
packaging:
49+
needs:
50+
- unit-tests-linux
51+
- unit-tests-windows
52+
53+
permissions:
54+
contents: read
55+
packages: write
56+
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Setup .NET SDK
63+
uses: actions/setup-dotnet@v4
64+
with:
65+
dotnet-version: |
66+
6.0.x
67+
7.0.x
68+
69+
- name: Restore
70+
run: dotnet restore
71+
72+
- name: Pack NuGet packages (CI versions)
73+
if: startsWith(github.ref, 'refs/heads/')
74+
run: dotnet pack --no-restore --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}"
75+
76+
- name: Pack NuGet packages (PR versions)
77+
if: startsWith(github.ref, 'refs/pull/')
78+
run: dotnet pack --no-restore --version-suffix "pr.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}"
79+
80+
- name: Publish NuGet packages (base)
81+
if: github.event.pull_request.head.repo.fork == false
82+
run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/open-feature/index.json
83+
84+
- name: Publish NuGet packages (fork)
85+
if: github.event.pull_request.head.repo.fork == true
86+
uses: actions/[email protected]
87+
with:
88+
name: nupkgs
89+
path: src/**/*.nupkg

build/Common.prod.props

+4-8
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>
@@ -16,7 +19,7 @@
1619
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1720
<Authors>OpenFeature Authors</Authors>
1821
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
19-
<Version>$(VersionNumber)</Version>
22+
<VersionPrefix>$(VersionNumber)</VersionPrefix>
2023
<AssemblyVersion>$(VersionNumber)</AssemblyVersion>
2124
<FileVersion>$(VersionNumber)</FileVersion>
2225
</PropertyGroup>
@@ -32,11 +35,4 @@
3235
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3336
</PropertyGroup>
3437

35-
<ItemGroup Condition="'$(Deterministic)'=='true'">
36-
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
37-
</ItemGroup>
38-
39-
<PropertyGroup Condition="'$(Deterministic)'=='true'">
40-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
41-
</PropertyGroup>
4238
</Project>

build/Common.props

+4
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
<PackageReference Include="System.Collections.Immutable" Version="[1.7.1,)" />
2929
<PackageReference Include="System.Threading.Channels" Version="[6.0.0,)" />
3030
</ItemGroup>
31+
32+
<ItemGroup Condition="'$(OS)' == 'Unix'">
33+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
34+
</ItemGroup>
3135
</Project>

0 commit comments

Comments
 (0)