Skip to content

Commit

Permalink
Add NuGet Package Versioning (#6)
Browse files Browse the repository at this point in the history
* fix(#5): nupkg versioning update

* fix(#5): Fix git versioning

* fix(#5): Optimize pipeline

* fix(#5): introduced manual release drafter (actual release)
  • Loading branch information
snovak7 committed May 13, 2024
1 parent 7a70f39 commit c42d0a8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
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

0 comments on commit c42d0a8

Please sign in to comment.