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 support for .NET 8 and 7 #182

Merged
merged 6 commits into from
Jul 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
27 changes: 24 additions & 3 deletions .github/actions/project-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ inputs:
target_framework:
description: 'The target framework to build on'
required: true
github_token:
description: 'GitHub token'
required: false
runtime_version:
description: 'Build runtime version default linux-x64'
required: false
default: 'linux-x64'
nuget_push:
description: 'Push to Nuget on release?'
required: false
default: false
nuget_key:
description: 'NuGet deploy key'
required: false
github_token:
description: 'GitHub token'
required: false
outputs:
version:
description: "Generated version (SemVersion compatible)"
Expand Down Expand Up @@ -81,4 +88,18 @@ runs:
pwsh -File .github/actions/project-build/run-command-for-every-tests-project.ps1 "$GITHUB_WORKSPACE/tests" '${{ steps.common-commands.outputs.dotnet-test }}'
env:
PROJECT_PATH: ${{ inputs.project_path }} # Used by commands in `common-commands` step
shell: bash

# Push to GitHub packages on each commit and release
- name: Push to NuGet (Nightly)
run: if ${{ inputs.nuget_push == 'true' && (github.event_name == 'push' || (github.event_name == 'create' && github.event.ref_type == 'tag')) }}; then
dotnet nuget push ${{ inputs.project_path }}/bin/Release/*.nupkg --api-key ${{ inputs.github_token }} --skip-duplicate --source https://nuget.pkg.github.com/RocketModFix/index.json;
fi
shell: bash

# Push to NuGet on each tag, but only if the tag is not a pre-release version
- name: Push to NuGet (Release)
run: if ${{ inputs.nuget_push == 'true' && github.event_name == 'create' && github.event.ref_type == 'tag' && steps.check-prerelease.outputs.is_prerelease == 'false' }}; then
dotnet nuget push ${{ inputs.project_path }}/bin/Release/*.nupkg --api-key ${{ inputs.nuget_key }} --skip-duplicate --source https://api.nuget.org/v3/index.json;
fi
shell: bash
75 changes: 0 additions & 75 deletions .github/workflows/BitMono.CLI.Release.net6.0.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/BitMono.CLI.Release.netstandard2.0.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/BitMono.CLI.Release.netstandard2.1.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: BitMono.CLI.Release.net462
name: BitMono.CLI.Release

on:
create:
Expand All @@ -8,7 +8,11 @@ on:
jobs:
Build:
if: github.event_name == 'create' && github.event.ref_type == 'tag'
runs-on: windows-latest
runs-on: ubuntu-latest
strategy:
matrix:
target-framework: [net8.0, net7.0, net6.0, net462, netstandard2.1, netstandard2.0]
runtime: [linux-x64, win-x64]

steps:
- name: Checkout code
Expand All @@ -25,14 +29,22 @@ jobs:
with:
project_path: src/BitMono.CLI
create_artifacts: true
target_framework: net462
nuget_push: false
target_framework: ${{ target-framework }}
runtime_version: ${{ matrix.runtime }}
github_token: ${{ secrets.PAT }}

- name: Install zip
run: sudo apt-get install zip

- name: Zip artifacts
run: "cd ./src/BitMono.CLI/bin/Release/${{ matrix.target-framework }}/${{ matrix.runtime }} && zip -qq -r ./release.zip *"

- name: Upload build
uses: actions/upload-artifact@v4
with:
name: build
path: "./src/BitMono.CLI/BitMono-v${{ github.ref_name }}-CLI-net462.zip"
path: "./src/BitMono.CLI/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip"
if-no-files-found: error

Release:
Expand Down Expand Up @@ -68,7 +80,7 @@ jobs:
with:
name: BitMono Release v${{ steps.get-version.outputs.version }}
tag: v${{ steps.get-version.outputs.version }}
artifacts: "./build/BitMono-v${{ github.ref_name }}-CLI-net462.zip"
artifacts: "./build/BitMono-v${{ github.ref_name }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip"
token: ${{ secrets.PAT }}
prerelease: ${{ steps.check-prerelease.outputs.is_prerelease }}
allowUpdates: true
Expand Down
22 changes: 13 additions & 9 deletions build.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,31 @@ Recommended to install tools via Visual Studio installer, otherwise you can inst

- [.NET Framework 462][net462]
- [Visual Studio 2022][vs2022]/[JetBrains Rider 2023][rider2023] or newer to build the solution
- [.NET 6.0 (Core)][net6]
- [.NET 8.0][net8]
- [.NET 7.0][net7]
- [.NET 6.0][net6]

### Artifacts

If you want to create a artifacts the same as BitMono do on release or you don't want to zip the output directory and set share it, then set `CreateBitMonoArtifacts` in SharedProjectProps.props to `true`, it will create an `.zip` archive file with build with currently selected one of the support/changed target frameworks.

Click build button, then go to `cloned repo path..\BitMono\src\BitMono.CLI` directory and you then you will see there `zip` archive artifacts. You can easily share them, just in case.

Archives examples (versions or naming can be a bit different):
- .NET 6.0: `BitMono-v0.18.0-alpha.33-CLI-net6.0.zip`
- .NET 462: `BitMono-v0.18.0-alpha.33-CLI-net462.zip`
- netstandard 2.1: `BitMono-v0.18.0-alpha.33-CLI-netstandard2.1.zip`
- netstandard 2.0: `BitMono-v0.18.0-alpha.33-CLI-netstandard2.0.zip`
Archives examples (versions and/or naming can be a bit different):
- .NET 7.0: `BitMono-v0.18.0-CLI-net8.0-linux-x64.zip`
- .NET 7.0: `BitMono-v0.18.0-CLI-net7.0-win-x64.zip`
- .NET 6.0: `BitMono-v0.18.0-CLI-net6.0-linux-x64.zip`
- .NET 462: `BitMono-v0.18.0-CLI-net462-win-x64.zip`
- netstandard 2.1: `BitMono-v0.18.0-CLI-netstandard2.1-linux-x64.zip`
- netstandard 2.0: `BitMono-v0.18.0-CLI-netstandard2.0-win-x64.zip`

### Help
If you have any issues/questions freely ask them [here][issues], or contact via:
- Email: sunnamed434@proton.me
- Email: sunnamed434 (at) proton.me

[net462]: https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462
[vs2022]: https://visualstudio.microsoft.com/downloads/
[rider2023]: https://www.jetbrains.com/rider/download/#section=windows
[net6]: https://dotnet.microsoft.com/en-us/download/dotnet/6.0
[net7]: https://dotnet.microsoft.com/en-us/download/dotnet/7.0
[net8]: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
[releases]: https://github.com/sunnamed434/BitMono/releases
[issues]: https://github.com/sunnamed434/BitMono/issues
1 change: 0 additions & 1 deletion props/SharedProjectProps.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);NU1701;NU1702;CS0436;CS1591</NoWarn>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<CreateBitMonoArtifacts>false</CreateBitMonoArtifacts>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
2 changes: 1 addition & 1 deletion src/BitMono.API/BitMono.API.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462;netstandard2.1;netstandard2.0;</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net462;netstandard2.1;netstandard2.0;</TargetFrameworks>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\props\SharedProjectProps.props" />
Expand Down
1 change: 0 additions & 1 deletion src/BitMono.API/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
global using AsmResolver.DotNet;
global using Autofac.Extensions.DependencyInjection;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using NullGuard;
Expand Down
Loading
Loading