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 'release' workflow on tag creation #12

Merged
merged 1 commit into from
Apr 27, 2023
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
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

jobs:
build:
needs: [check-commit-message]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Parse tag name
shell: bash
run: |
REF_NAME=${{ github.ref_name }}
VERSION=${REF_NAME#v}
SEMVER_REGEX='^((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*))(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$'
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [[ $VERSION =~ $SEMVER_REGEX ]]
then
echo "MAIN_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
echo "PRE_RELEASE_VERSION=${BASH_REMATCH[6]}" >> $GITHUB_ENV
else
echo "$VERSION doesn't match"
fi
- name: Publish
run: dotnet publish ./src/Joba.IBM.RPA.Cli/Joba.IBM.RPA.Cli.csproj -c Release -f net7.0 -r win-x64 -p:PublishSingleFile=true -p:VersionPrefix=${MAIN_VERSION} -p:VersionSufix=${PRE_RELEASE_VERSION} -o ./publish --self-contained
- name: Release
shell: pwsh
run: |
if ( $null -eq "${{env.PRE_RELEASE_VERSION}}" -or "${{env.PRE_RELEASE_VERSION}}" -eq '' ) {
gh release create ${{ github.ref_name }} './publish/rpa.exe#rpa cli' --title "Release ${{env.VERSION}}" --verify-tag --generate-notes
}
else {
gh release create ${{ github.ref_name }} './publish/rpa.exe#rpa cli' --title "Release ${{env.VERSION}}" --verify-tag --prerelease --generate-notes
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
# *.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
Expand Down Expand Up @@ -368,6 +368,7 @@ MigrationBackup/
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
12 changes: 0 additions & 12 deletions src/Joba.IBM.RPA.Cli/Constants.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/Joba.IBM.RPA.Cli/Joba.IBM.RPA.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PackageOutputPath>./nupkg</PackageOutputPath>
<AssemblyName>rpa</AssemblyName>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>beta-8</VersionSuffix>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
Expand Down
6 changes: 2 additions & 4 deletions src/Joba.IBM.RPA.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.Extensions.Logging;
using System.CommandLine.Builder;
using System.CommandLine.Parsing;
using System.Diagnostics;
using System.Reflection;

namespace Joba.IBM.RPA.Cli
Expand All @@ -19,8 +18,6 @@ public static Task<int> Main(string[] args)
// dotnet tool update --global --add-source ./Joba.IBM.RPA.Cli/nupkg --version 1.0.0-beta-8 rpa
// [uninstall]
// dotnet tool uninstall --global rpa
Directory.CreateDirectory(Constants.LocalFolder);

var parser = new CommandLineBuilder(new RpaCommand())
.AddInstrumentation()
.RegisterLoggerFactory()
Expand All @@ -42,7 +39,8 @@ private static void OnException(Exception exception, InvocationContext context)
{
var loggerFactory = context.BindingContext.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<RpaCommand>();
logger.LogError(exception, exception.Message);
var verbosity = context.ParseResult.GetValueForOption(RpaCommand.VerbosityOption);
logger.LogError(exception, verbosity == Verbosity.Diagnostic || verbosity == Verbosity.Detailed ? exception.ToString() : exception.Message);

EnvironmentException(exception);
PackageAlreadyInstalledException(exception);
Expand Down
2 changes: 2 additions & 0 deletions src/Joba.IBM.RPA/Git/GitConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ internal async Task CreateConversionWrapperAsync(CancellationToken cancellation)
private string GetContents() => $"#!/bin/bash" + System.Environment.NewLine + gitDiffCommandLine;

/// <summary>
/// TODO: this is wrong: https://stackoverflow.com/questions/69903900/how-to-maintain-environment-variables-in-path-when-adding-new-path-folder
/// https://stackoverflow.com/a/9845159/1830639
/// The directory where the 'wal2txt' (conversion intermediate file) file is located needs to be in the windows environment PATH so git can reach it.
/// </summary>
private void AppendToPathEnvironmentVariable()
Expand Down