-
Notifications
You must be signed in to change notification settings - Fork 33
chore: Add support for GitHub Packages #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
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 | ||
env: | ||
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
source-url: https://nuget.pkg.github.com/open-feature/index.json | ||
|
||
- name: Restore | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --no-restore | ||
|
||
- name: Test | ||
run: dotnet test --no-build --logger GitHubActions | ||
|
||
packaging: | ||
needs: build | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
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 | ||
env: | ||
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
source-url: https://nuget.pkg.github.com/open-feature/index.json | ||
|
||
- 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/[email protected] | ||
with: | ||
name: nupkgs | ||
path: src/**/*.nupkg |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"rollForward": "latestFeature", | ||
"version": "8.0.100" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<configuration> | ||
|
||
<packageSources> | ||
<add key="nuget" value="https://api.nuget.org/v3/index.json" /> | ||
<add key="github-open-feature" value="https://nuget.pkg.github.com/open-feature/index.json" /> | ||
</packageSources> | ||
|
||
<packageSourceMapping> | ||
<packageSource key="nuget"> | ||
<package pattern="OpenFeature" /> | ||
<package pattern="OpenFeature.*" /> | ||
<package pattern="*" /> | ||
</packageSource> | ||
<packageSource key="github-open-feature"> | ||
<package pattern="OpenFeature" /> | ||
<package pattern="OpenFeature.*" /> | ||
</packageSource> | ||
</packageSourceMapping> | ||
|
||
</configuration> | ||
Comment on lines
+1
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note Note: these instructions are also available in CONTRIBUTING.md Following open-feature/dotnet-sdk#173, it is now possible for this repo to consume pre-release packages from This file provides Currently, this repo does not yet reference any pre-release package versions, so there is no action required today for contributors. However, contributors can prepare their local environments using the following instructions:
Related |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,16 @@ | |
<PropertyGroup> | ||
<PackageId>OpenFeature.Contrib.Provider.FeatureManagement</PackageId> | ||
<VersionNumber>0.0.1</VersionNumber> | ||
<Version>$(VersionNumber)-preview</Version> | ||
<VersionPrefix>$(VersionNumber)</VersionPrefix> | ||
<VersionSuffix>preview</VersionSuffix> | ||
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. N.B. |
||
<AssemblyVersion>$(VersionNumber)</AssemblyVersion> | ||
<FileVersion>$(VersionNumber)</FileVersion> | ||
<Description>An OpenFeature Provider built on top of the standard Microsoft FeatureManagement Library</Description> | ||
<PackageProjectUrl>https://openfeature.dev</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/open-feature/dotnet-sdk-contrib</RepositoryUrl> | ||
<Authors>Eric Pattison</Authors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.FeatureManagement" Version="4.0.0-preview" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this change impact the
Publish to Nuget
step?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it should not, because in that step we explicitly pass the requisite API token.
This pattern here is just telling
actions/setup-dotnet
to (more or less) rundotnet nuget update source ...
for thissource-url
using the ambientNUGET_AUTH_TOKEN
while setting up the SDK.As an alternative to pre-configuring this
source-url
here, we could instead pass additional sources and tokens todotnet restore
, but that gets really messy really fast, so the usual pattern is to just pre-configure your authenticated NuGet sources as part of setting up the .NET SDK.I get this question a lot in repos where I'm setting up GitHub Actions for the first time, so often find myself wishing they had instead implemented
source-url
assource-urls: [ ... ]
which would let us be more expressive aboutNUGET_AUTH_TOKEN
being for, and only for, onesource-url
, but as things stand repos that want to pre-wire two auth'd feeds just end up running this step twice, once for eachsource-url
andNUGET_AUTH_TOKEN
.Here's a snippet from the CI logs that kind of allude to this^ story (albeit, not very clearly, but if you squint you can kind of picture what its doing):