4 Commits

Author SHA1 Message Date
Matthias Langhard
b6a4a8f8ec chore: bumps version number 2021-11-04 21:23:06 +01:00
Matthias Langhard
5e1dd98ecd deploy: runs tests only on tags 2021-11-04 21:22:49 +01:00
Matthias Langhard
7b7fafbce9 feat: implements spinner which runs when pushing tags / commits to remote 2021-11-04 21:20:41 +01:00
Matthias Langhard
8a8b16c655 feat: implements better commandline args parsing with '--version' and '--help' outputs 2021-11-04 21:13:40 +01:00
5 changed files with 33 additions and 6 deletions

View File

@@ -3,6 +3,8 @@ stages:
- publish
running tests for tag:
only:
- tags
image: mcr.microsoft.com/dotnet/sdk:5.0
stage: test
script:

View File

@@ -25,11 +25,18 @@ namespace Cli
var repoBasePath = await GetRepoBasePath(workingDir);
var chosenService = await ChooseService(repoBasePath);
var selection = await SelectVersion(repoBasePath, chosenService);
await AddVersionTagToRepo(repoBasePath, selection.Version.ToString());
await PushTagsToRemote(repoBasePath);
await PushCommitsToRemote(repoBasePath);
await AnsiConsole.Status()
.StartAsync("pushing to remote...", async _ =>
{
await AddVersionTagToRepo(repoBasePath, selection.Version.ToString());
await PushTagsToRemote(repoBasePath);
await PushCommitsToRemote(repoBasePath);
}
);
}
private async Task<string> GetRepoBasePath(string workingDir)
{
var repoBasePath = "";

View File

@@ -6,10 +6,11 @@
<RootNamespace>Cli</RootNamespace>
<PackAsTool>true</PackAsTool>
<ToolCommandName>update-tag</ToolCommandName>
<AssemblyTitle>update-tag</AssemblyTitle>
<PackageId>Novaloop.UpdateTag</PackageId>
<title>Updates the tag of a repo to the next chosen version according the semver symantic.</title>
<PackageTags>semver;update-tag;tag;git</PackageTags>
<Version>0.4.0</Version>
<Version>0.6.0</Version>
<Authors>Matthias Langhard</Authors>
<Company>Novaloop AG</Company>
<PackageProjectUrl>https://gitlab.com/novaloop-oss/novaloop.update-tag</PackageProjectUrl>
@@ -18,6 +19,7 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0"/>
<PackageReference Include="Spectre.Console" Version="0.42.0"/>

View File

@@ -0,0 +1,10 @@
using CommandLine;
namespace Cli.Models
{
public class CliParams
{
[Option('r', "repository-path", Required = false, HelpText = "Run update-tag on a git repository other than the current directory.")]
public string RepositoryPath { get; set; }
}
}

View File

@@ -1,7 +1,8 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Application;
using Cli.Models;
using CommandLine;
using Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -21,9 +22,14 @@ namespace Cli
.ServiceProvider
.GetRequiredService<AppRunner>();
await appRunner.Run(args.FirstOrDefault() ?? Environment.CurrentDirectory);
await Parser.Default
.ParseArguments<CliParams>(args)
.WithParsedAsync(
async options => { await appRunner.Run(options.RepositoryPath ?? Environment.CurrentDirectory); }
);
}
private static IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder()