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 GitVersion tool installation and versioning to CI/CD workflows; #317

Merged
merged 4 commits into from
Nov 24, 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
17 changes: 16 additions & 1 deletion .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ jobs:
dotnet coverage collect "dotnet test src/WHMapper.Tests -c Release" -f xml -o "coverage.xml"
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: Install GitVersion
if: github.event_name != 'pull_request'
run: dotnet tool install --global GitVersion.Tool

- name: Generate version
if: github.event_name != 'pull_request'
run: gitversion /output json /showvariable FullSemVer
id: gitversion

- name: Update .csproj version
if: github.event_name != 'pull_request'
run: |
VERSION=${{ steps.gitversion.outputs.FullSemVer }}
sed -i "s/<Version>.*<\/Version>/<Version>$VERSION<\/Version>/" src/WHMapper/WHMapper.csproj

- name: Generate Artifact
if: github.event_name != 'pull_request'
run: |
Expand Down Expand Up @@ -171,7 +186,7 @@ jobs:
org.opencontainers.image.authors=${{ github.actor }}
tags: |
type=edge,branch=$repo.default_branch
type=semver,pattern=v{{version}}
type=semver,pattern={{version}}
type=sha,prefix=,suffix=,format=short

- name: Authenticate to registry ${{ env.REGISTRY_DOCKERHUB }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ jobs:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: 📦 Generate Package (linux x64/arm, Windows x64)
run: |
dotnet restore src
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r linux-x64 --nologo --output ./release/linux-x64
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r linux-arm --nologo --output ./release/linux-arm
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r win-x64 --nologo --output ./release/win-x64
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r linux-x64 --nologo --output ./release/linux-x64 /p:Version=${{ env.VERSION }}
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r linux-arm --nologo --output ./release/linux-arm /p:Version=${{ env.VERSION }}
dotnet publish src/WHMapper/WHMapper.csproj -c Release -r win-x64 --nologo --output ./release/win-x64 /p:Version=${{ env.VERSION }}

zip -r WHMapper.linux-x64.zip ./release/linux-x64 -j
zip -r WHMapper.linux-arm.zip ./release/linux-arm -j
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/eve-whmapper/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- net

whmapper:
image: ghcr.io/pfh59/eve-whmapper:latest
image: ghcr.io/pfh59/eve-whmapper:1.1
restart: unless-stopped
environment:
- EveSSO__ClientId=xxxxxxxxx
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/deploys/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: evemapper-app
image: ghcr.io/pfh59/eve-whmapper:latest
image: ghcr.io/pfh59/eve-whmapper:1.1
envFrom:
- configMapRef:
name: evemapper-config-map
Expand Down
12 changes: 6 additions & 6 deletions src/WHMapper.Tests/WHMapper.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="21.0.29" />
<PackageReference Include="Testably.Abstractions.Compression" Version="3.2.3" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="21.1.3" />
<PackageReference Include="Testably.Abstractions.Compression" Version="3.2.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Npgsql" Version="8.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" />
<PackageReference Include="Npgsql" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Xunit.Priority" Version="1.1.6" />
</ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions src/WHMapper/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
{
<MudLayout @oncustompaste="HandleCustomPaste" class="overflow-x-hidden">
<MudAppBar Elevation="1" Dense=true>
<MudText Typo="Typo.h5" Class="ml-3">Wormhole Mapper</MudText>
<MudText Typo="Typo.h5" Class="ml-5">Wormhole Mapper</MudText>
<MudChip T="string" Class="ml-5" Disabled="true" Variant="Variant.Outlined" >@String.Format("v{0}", Version)</MudChip>
<MudSpacer />
<AccessControl />
</MudAppBar>
Expand All @@ -55,6 +56,7 @@
private MudTheme _currentTheme = null!;
private bool _loading = true;
private string _init_process_msg = string.Empty;
private string Version { get; set; } = string.Empty;

[Inject]
private ISnackbar Snackbar {get;set;} =null!;
Expand Down Expand Up @@ -90,10 +92,12 @@
Primary = "#ffffff",
PrimaryDarken = "#ffffff",
PrimaryLighten = "#ffffff"

}
};

var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Version = version != null ? version.ToString(3) : "Unknown";

if(SDEServices.IsExtractionSuccesful())
{
_loading = false;
Expand Down
27 changes: 14 additions & 13 deletions src/WHMapper/WHMapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<DockerComposeProjectPath>../docker-compose.dcproj</DockerComposeProjectPath>
<UserSecretsId>6545e3a1-0941-41bf-a51b-1a58ca6ed175</UserSecretsId>
<Version>0.0.0</Version>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -76,27 +77,27 @@
<ItemGroup>
<PackageReference Include="Blazor.ContextMenu" Version="2.1.0" />
<PackageReference Include="FibonacciHeap" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.11" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.11" />
<PackageReference Include="MudBlazor.ThemeManager" Version="2.1.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.1.2" />
<PackageReference Include="System.IO.Abstractions" Version="21.0.29" />
<PackageReference Include="Testably.Abstractions.Compression" Version="3.2.3" />
<PackageReference Include="System.IO.Abstractions" Version="21.1.3" />
<PackageReference Include="Testably.Abstractions.Compression" Version="3.2.4" />
<PackageReference Include="Z.Blazor.Diagrams" Version="3.0.2" />
<PackageReference Include="Z.Blazor.Diagrams.Algorithms" Version="3.0.2" />
<PackageReference Include="Z.Blazor.Diagrams.Core" Version="3.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Npgsql" Version="8.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Npgsql" Version="8.0.6" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentValidation" Version="11.10.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
<PackageReference Include="YamlDotNet" Version="16.1.3" />
<PackageReference Include="MudBlazor" Version="7.8.*" />
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.11" />
<PackageReference Include="YamlDotNet" Version="16.2.0" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
Expand Down
Loading