Skip to content
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

Add NuGet Package Versioning #6

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ on:
- opened
- reopened
- synchronize
workflow_dispatch: {}
workflow_dispatch:
inputs:
release-type:
type: choice
default: prerelease
description: Release Type
options:
- release
- prerelease

concurrency:
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref }}
Expand All @@ -25,5 +33,7 @@ jobs:
steps:
- name: "Draft Release"
uses: release-drafter/[email protected]
with:
prerelease: ${{ github.event.inputs.release-type == 'prerelease' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 13 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ on:
release:
types:
- published
workflow_dispatch: {}
workflow_dispatch: {}

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_DIR: ${{ github.workspace}}/nuget

jobs:
publish:
Expand All @@ -26,10 +25,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Setup .NET Core SDK 8
uses: actions/setup-dotnet@v4
with:
Expand All @@ -38,11 +34,6 @@ jobs:
- name: Restore .NET Packages
run: dotnet restore

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- name: Build .NET Solution
run: dotnet build --configuration Release --no-restore

Expand All @@ -55,9 +46,16 @@ jobs:
run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }}

- name: Publish .NET Solution to NuGet.org
env:
apikey: ${{ secrets.NUGET_ORG_KEY }}
- name: Store .NET Package
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: pack/*.(s?)nupkg
if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }}
run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget

- name: Publish .NET Solution to NuGet.org
continue-on-error: true
run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget
if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }}
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<RepositoryUrl>https://github.com/InfinityFlowApp/tools-nuget-branding</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="GitVersion.MsBuild" Version="5.12.0"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
mode: ContinuousDeployment
branches:
master:
mode: ContinuousDeployment
tag: rc
pull-request:
tag: pr