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

Updated to the latest nuke packages #2430

Merged
merged 2 commits into from
Dec 18, 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
50 changes: 28 additions & 22 deletions .build/Build.CI.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,61 @@
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.CI.GitHubActions.Configuration;
using Rocket.Surgery.Nuke.ContinuousIntegration;
using Rocket.Surgery.Nuke.GithubActions;
using Rocket.Surgery.Nuke.Jobs;

#pragma warning disable CA1050

[GitHubActionsSteps(
"ci-ignore",
GitHubActionsImage.UbuntuLatest,
AutoGenerate = false,
On = new[] { RocketSurgeonGitHubActionsTrigger.Push },
OnPushTags = new[] { "v*" },
OnPushBranches = new[] { "master", "main", "next" },
OnPullRequestBranches = new[] { "master", "main", "next" },
Enhancements = new[] { nameof(CiIgnoreMiddleware) }
On = [RocketSurgeonGitHubActionsTrigger.Push],
OnPushTags = ["v*"],
OnPushBranches = ["master", "main", "next"],
OnPullRequestBranches = ["master", "main", "next"],
Enhancements = [nameof(CiIgnoreMiddleware)]
)]
[GitHubActionsSteps(
"ci",
GitHubActionsImage.UbuntuLatest,
AutoGenerate = false,
On = new[] { RocketSurgeonGitHubActionsTrigger.Push },
OnPushTags = new[] { "v*" },
OnPushBranches = new[] { "master", "main", "next" },
OnPullRequestBranches = new[] { "master", "main", "next" },
InvokedTargets = new[] { nameof(Default) },
Enhancements = new[] { nameof(CiMiddleware) }
On = [RocketSurgeonGitHubActionsTrigger.Push],
OnPushTags = ["v*"],
OnPushBranches = ["master", "main", "next"],
OnPullRequestBranches = ["master", "main", "next"],
InvokedTargets = [nameof(Default)],
Enhancements = [nameof(CiMiddleware)]
)]
[GitHubActionsLint(
"lint",
GitHubActionsImage.UbuntuLatest,
AutoGenerate = false,
OnPullRequestTargetBranches = new[] { "master", "main", "next" },
Enhancements = new[] { nameof(LintStagedMiddleware) }
OnPullRequestTargetBranches = ["master", "main", "next"],
Enhancements = [nameof(LintStagedMiddleware)]
)]
[PrintBuildVersion]
[CloseMilestoneJob]
[DraftReleaseJob]
[UpdateMilestoneJob]
[PublishNugetPackagesJob("RSG_NUGET_API_KEY", "ci")]
[PrintCIEnvironment]
[UploadLogs]
[TitleEvents]
[ContinuousIntegrationConventions]
public partial class Pipeline
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]
internal partial class Pipeline
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay => ToString();

Check warning on line 48 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / lint

Possible null reference return.

Check warning on line 48 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
((RocketSurgeonsGithubActionsJob)configuration.Jobs[0]).Steps = new List<GitHubActionsStep>
{
( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps =
[
new RunStep("N/A")
{
Run = "echo \"No build required\""
}
};
];

return configuration.IncludeRepositoryConfigurationFiles();
}
Expand All @@ -57,10 +64,9 @@
{
var job = configuration
.ExcludeRepositoryConfigurationFiles()
.AddNugetPublish()
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name.Equals("build", StringComparison.OrdinalIgnoreCase));
job
_ = job
.UseDotNetSdks("8.0", "9.0")
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
.PublishLogs<Pipeline>();
Expand All @@ -70,7 +76,7 @@

public static RocketSurgeonGitHubActionsConfiguration LintStagedMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
configuration
_ = configuration
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
.UseDotNetSdks("8.0", "9.0");
Expand Down
2 changes: 1 addition & 1 deletion .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[NuGetVerbosityMapping]
[ShutdownDotNetAfterServerBuild]
[LocalBuildConventions]
public partial class Pipeline : NukeBuild,
internal partial class Pipeline : NukeBuild,
ICanRestoreWithDotNetCore,
ICanBuildWithDotNetCore,
ICanTestWithDotNetCore,
Expand Down
5 changes: 5 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
"version": "0.7.2",
"commands": ["husky"],
"rollForward": false
},
"gitreleasemanager.tool": {
"version": "0.18.0",
"commands": ["dotnet-gitreleasemanager"],
"rollForward": false
}
}
}
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,3 @@ jobs:
with:
name: 'nuget'
path: 'artifacts/nuget/'
Publish:
needs:
- Build
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
secrets:
RSG_NUGET_API_KEY: '${{ secrets.RSG_NUGET_API_KEY }}'
RSG_AZURE_DEVOPS: '${{ secrets.RSG_AZURE_DEVOPS }}'
98 changes: 93 additions & 5 deletions .github/workflows/close-milestone.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,98 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [CloseMilestoneJob (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_close-milestone --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

name: Close Milestone

on:
workflow_call:
secrets:
RSG_BOT_TOKEN:
required: true
release:
types:
- released
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: write
discussions: none
packages: none
pages: none
pull-requests: write
repository-projects: none
security-events: none
statuses: write

jobs:
close_milestone:
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
secrets:
RSG_BOT_TOKEN: ${{ secrets.RSG_BOT_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: 'false'
fetch-depth: '0'
- name: Fetch all history for all tags and branches
run: |
git fetch --prune
- name: 📲 Install DotNet
uses: actions/setup-dotnet@v4
- name: ⚒️ dotnet tool restore
run: |
dotnet tool restore
- name: 🔨 Use GitVersion
id: gitversion
shell: pwsh
run: |
$data = dotnet gitversion | ConvertFrom-Json
foreach ($item in $data.PSObject.Properties) {
$key = $item.Name
$value = $item.Value
echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT
}
- name: Create Milestone
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
uses: WyriHaximus/github-action-create-milestone@v1
with:
title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}'
- name: sync milestones
uses: RocketSurgeonsGuild/actions/[email protected]
with:
default-label: ':sparkles: mysterious'
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: 📲 Install GitReleaseManager
uses: gittools/actions/gitreleasemanager/[email protected]
with:
versionSpec: '0.18.0'
- name: Get Repo and Owner
id: repository
if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }}
shell: pwsh
run: |
$parts = $ENV:GITHUB_REPOSITORY.Split('/')
echo "::set-output name=owner::$($parts[0])"
echo "::set-output name=repository::$($parts[1])"
- name: Close Milestone
if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }}
shell: pwsh
run: |
dotnet gitreleasemanager close `
-o "${{ steps.repository.outputs.owner }}" `
-r "${{ steps.repository.outputs.repository }}" `
--token "${{ secrets.GITHUB_TOKEN }}" `
-m "v${{ steps.gitversion.outputs.majorMinorPatch }}"
95 changes: 89 additions & 6 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,97 @@
name: Create Milestone and Draft Release
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [DraftReleaseJob (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_draft-release --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

name: Draft Release and Create Milestone

on:
workflow_call:
secrets:
RSG_BOT_TOKEN:
required: true
push:
branches:
- master
- 'master'
paths-ignore:
- '**/*.md'
schedule:
- cron: '0 0 * * 4'
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: write
discussions: none
packages: none
pages: none
pull-requests: write
repository-projects: none
security-events: none
statuses: write

jobs:
create_milestone_and_draft_release:
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
secrets:
RSG_BOT_TOKEN: ${{ secrets.RSG_BOT_TOKEN }}
draft_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: 'false'
fetch-depth: '0'
- name: Fetch all history for all tags and branches
run: |
git fetch --prune
- name: 📲 Install DotNet
uses: actions/setup-dotnet@v4
- name: ⚒️ dotnet tool restore
run: |
dotnet tool restore
- name: 🔨 Use GitVersion
id: gitversion
shell: pwsh
run: |
$data = dotnet gitversion | ConvertFrom-Json
foreach ($item in $data.PSObject.Properties) {
$key = $item.Name
$value = $item.Value
echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT
}
- name: Create Milestone
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
uses: WyriHaximus/github-action-create-milestone@v1
with:
title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}'
- name: sync milestones
uses: RocketSurgeonsGuild/actions/[email protected]
with:
default-label: ':sparkles: mysterious'
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: 'true'
generateReleaseNotes: 'true'
updateOnlyUnreleased: 'true'
draft: 'true'
omitBodyDuringUpdate: 'true'
omitNameDuringUpdate: 'true'
omitDraftDuringUpdate: 'true'
name: 'v${{ steps.gitversion.outputs.majorMinorPatch }}'
tag: 'v${{ steps.gitversion.outputs.majorMinorPatch }}'
token: '${{ secrets.RSG_BOT_TOKEN }}'
commit: '${{ github.base_ref }}'
Loading
Loading