added gitea pipeline

This commit is contained in:
Michael Samorokov 2025-01-22 09:34:13 -07:00
parent 7ca04eb538
commit e6d2c8ac37
3 changed files with 80 additions and 6 deletions

View File

@ -0,0 +1,52 @@
name: CI Build
on:
push:
branches: [ master ]
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: write
packages: write
env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry
MINOR_VERSION_OVERRIDE: 0
GITEA_SERVER_URL: ${{ secrets.S_GITEA_SERVER_URL }}
GITEA_PACKAGE_OWNER: ${{ secrets.S_GITEA_PACKAGE_OWNER }}
GITEA_PACKAGE_OWNER_USER: ${{ secrets.S_GITEA_PACKAGE_OWNER_USER }}
GITEA_PACKAGE_OWNER_PASSWORD: ${{ secrets.S_GITEA_PACKAGE_OWNER_PASSWORD }}
GITEA_NUGET_SOURCE_NAME: ${{ vars.S_GITEA_NUGET_SOURCE_NAME }}
jobs:
build-ci-api:
runs-on: [linux,self-hosted]
name: CI Build API
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Setup .NET 9
uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Make Build File Executable
shell: bash
run: |
chmod +x ./build.cmd
chmod +x ./build.sh
- name: Run Nuke Build
shell: bash
run: |
./build.cmd -Target Publish

View File

@ -13,14 +13,21 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisStreamsProvider.UnitTe
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{EE8F826D-AFB3-4708-BBA3-894C1B145C44}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{EE8F826D-AFB3-4708-BBA3-894C1B145C44}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci", "ci", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".gitea", ".gitea", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
.gitea\workflows\ci-pipeline.yml = .gitea\workflows\ci-pipeline.yml
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EE8F826D-AFB3-4708-BBA3-894C1B145C44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE8F826D-AFB3-4708-BBA3-894C1B145C44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -37,10 +44,15 @@ Global
{DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Release|Any CPU.Build.0 = Release|Any CPU {DF927C2B-A141-4476-86CF-3B4DC8ECB4DE}.Release|Any CPU.Build.0 = Release|Any CPU
{EE8F826D-AFB3-4708-BBA3-894C1B145C44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE8F826D-AFB3-4708-BBA3-894C1B145C44}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9A8081FD-99C7-4302-A892-DC1DE30F4853} SolutionGuid = {9A8081FD-99C7-4302-A892-DC1DE30F4853}
EndGlobalSection EndGlobalSection

View File

@ -8,6 +8,7 @@ using Nuke.Common.IO;
using Nuke.Common.ProjectModel; using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling; using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.Git;
using Nuke.Common.Tools.GitVersion; using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Utilities.Collections; using Nuke.Common.Utilities.Collections;
using static Nuke.Common.EnvironmentInfo; using static Nuke.Common.EnvironmentInfo;
@ -23,7 +24,6 @@ class Build : NukeBuild
public static int Main() => Execute<Build>(x => x.Pack); public static int Main() => Execute<Build>(x => x.Pack);
private const string NuGetSourceUrl = "https://api.nuget.org/v3/index.json";
private const string LibraryProjectName = "Universley.OrleansContrib.StreamsProvider.Redis"; private const string LibraryProjectName = "Universley.OrleansContrib.StreamsProvider.Redis";
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
@ -43,6 +43,9 @@ class Build : NukeBuild
[Parameter("NuGet API key")] [Parameter("NuGet API key")]
readonly string NuGetApiKey; readonly string NuGetApiKey;
[Parameter("Gitea Nuget package source name")]
readonly string GiteaNugetSourceName = Environment.GetEnvironmentVariable("GITEA_NUGET_SOURCE_NAME");
Target Clean => _ => _ Target Clean => _ => _
.Before(Restore) .Before(Restore)
.Executes(() => .Executes(() =>
@ -106,14 +109,21 @@ class Build : NukeBuild
.Executes(() => .Executes(() =>
{ {
DotNetTasks.DotNetNuGetPush(s => s DotNetTasks.DotNetNuGetPush(s => s
.SetSource(NuGetSourceUrl) .SetSource(GiteaNugetSourceName)
.SetApiKey(NuGetApiKey) .SetApiKey(NuGetApiKey)
.SetTargetPath(NuGetPackagesDirectory / $"{LibraryProjectName}.{GitVersion.NuGetVersionV2}.snupkg")); .SetTargetPath(NuGetPackagesDirectory / $"{LibraryProjectName}.{GitVersion.NuGetVersionV2}.snupkg"));
DotNetTasks.DotNetNuGetPush(s => s DotNetTasks.DotNetNuGetPush(s => s
.SetSource(NuGetSourceUrl) .SetSource(GiteaNugetSourceName)
.SetApiKey(NuGetApiKey)
.SetTargetPath(NuGetPackagesDirectory / $"{LibraryProjectName}.{GitVersion.NuGetVersionV2}.nupkg")); .SetTargetPath(NuGetPackagesDirectory / $"{LibraryProjectName}.{GitVersion.NuGetVersionV2}.nupkg"));
}); });
Target CreateAndPushGitTag => _ => _
.Executes(() =>
{
var gitTag = $"{GitVersion.NuGetVersionV2}";
GitTasks.Git($"tag {gitTag}");
GitTasks.Git($"push origin {gitTag}");
});
}
} }