forked from Code-Artist/AGauge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nutdotnet/6-full-cd
Implement CI/CD
- Loading branch information
Showing
9 changed files
with
140 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Verify valid semver from Ref string, and provide it along with an AssemblyVersion-compatible string as outputs. | ||
|
||
# Set to the value provided by github.ref | ||
param([string]$ghRef) | ||
|
||
$semVerRegex = "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" | ||
$matchInfo = [regex]::Match($ghRef, $semVerRegex) | ||
|
||
if (!($matchInfo.Success)) { | ||
Write-Host "Could not find valid semver within ref. string. Given: $ghRef" | ||
Exit 1 | ||
} | ||
|
||
$verRes = "ASMVER={0}.{1}.{2}" -f $matchInfo.Groups["major"], $matchInfo.Groups["minor"], $matchInfo.Groups["patch"] | ||
$semVerRes = "SEMVER=" + $matchInfo.Value | ||
$isPr = "ISPRERELEASE=" + $matchInfo.Groups.ContainsKey("prerelease") | ||
|
||
echo $verRes >> $env:GITHUB_OUTPUT | ||
echo $semVerRes >> $env:GITHUB_OUTPUT | ||
echo $isPr >> $env:GITHUB_OUTPUT | ||
|
||
Write-Host "Result: $verRes, $semVerRes, $isPr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: build-debug | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
# Cause GH to build only for modified code files in a PR, but not when a tag is specified (https://stackoverflow.com/a/71879890/530172) | ||
pull_request: | ||
paths: | ||
- "**.cs" | ||
- "**.csproj" | ||
|
||
env: | ||
PRIMARY_FOLDER: AGauge | ||
|
||
jobs: | ||
build-debug: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
|
||
- name: Build Project | ||
run: > | ||
dotnet build ${{ env.PRIMARY_FOLDER }}\AGauge.csproj | ||
--nologo | ||
-c Debug | ||
-p:Version=1.0.0.0 | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: AGauge-Debug-CIBuild_${{ github.run_number }} | ||
path: ${{ env.PRIMARY_FOLDER }}\bin\Debug | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,53 @@ | ||
# name: build-release-$(git rev-parse --short "$GITHUB_SHA") | ||
run-name: Build-Release Num. ${{ github.run_number }} | ||
name: build-release | ||
|
||
on: | ||
workflow_dispatch: | ||
# inputs: | ||
# configuration: | ||
# description: 'Compiler configuration preset' | ||
# required: false | ||
# default: 'Debug' | ||
# pull_request: | ||
# branches: [ main ] | ||
# paths: | ||
# - '**.vb' | ||
# - '**.vbproj' | ||
# - '**.cs' | ||
# - '**.csproj' | ||
# - '**.resx' | ||
push: | ||
tags: "v*" | ||
branches: "main" | ||
|
||
env: | ||
DOTNET_VERSION: '4.7.2' # The .NET SDK version to use | ||
SLN_FILE: AGauge/AGauge.sln | ||
OUTPUT: AGauge/bin/Release | ||
CONFIG: Release | ||
PRIMARY_FOLDER: AGauge | ||
NUGET_API_URL: https://api.nuget.org/v3/index.json | ||
|
||
jobs: | ||
build: | ||
|
||
name: debug-build-${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest] # Should have MSBuild. | ||
runs-on: windows-latest | ||
steps: | ||
# Make MSBuild available from $PATH. | ||
- name: setup-msbuild | ||
uses: microsoft/setup-msbuild@v1 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Extract version info | ||
id: exVer | ||
run: .\.github\get-ver.ps1 ${{ github.ref }} | ||
|
||
# - name: Restore Packages | ||
# run: msbuild -t:restore | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
|
||
- name: Build solution | ||
run: msbuild $env:SLN_FILE -p:Configuration=$env:CONFIG | ||
- name: Build Project | ||
run: > | ||
dotnet build ${{ env.PRIMARY_FOLDER }}\AGauge.csproj | ||
--nologo | ||
-c Release | ||
-p:Version=${{ steps.exVer.outputs.ASMVER }} | ||
-p:PackageVersion=${{ steps.exVer.outputs.SEMVER }} | ||
- name: Get AssemblyVersion generated by msbuild | ||
id: getversion | ||
uses: berglie/assembly-version/get@v1 | ||
with: | ||
directory: ${{ env.OUTPUT }} | ||
- name: Push to NuGet | ||
run: > | ||
dotnet nuget push | ||
${{ env.PRIMARY_FOLDER }}\bin\Release\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source ${{ env.NUGET_API_URL }} | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ format('AGauge-v{0}', steps.getversion.outputs.version) }} | ||
name: AGauge-Release-CIBuild_${{ github.run_number }} | ||
path: ${{ env.PRIMARY_FOLDER }}\bin\Release | ||
if-no-files-found: error | ||
path: ${{ env.OUTPUT }} | ||
|
||
|
||
- name: Create GH Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: true | ||
prerelease: ${{ steps.exVer.outputs.ISPRERELEASE }} | ||
files: ${{ env.PRIMARY_FOLDER }}/bin/Release/* | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{CBDB1D25-5A95-43D4-A958-BF6AE65C6C3F}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>System.Windows.Forms</RootNamespace> | ||
<AssemblyName>AGauge.Classic</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
<TargetFramework>net472</TargetFramework> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="AGauge.cs"> | ||
<Compile Update="AGauge.cs"> | ||
<SubType>Component</SubType> | ||
</Compile> | ||
<Compile Include="AGauge.Designer.cs"> | ||
<DependentUpon>AGauge.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="AGaugeLabel.cs" /> | ||
<Compile Include="AGaugeLabelCollection.cs" /> | ||
<Compile Include="AGaugeNeedleColor.cs" /> | ||
<Compile Include="AGaugeRange.cs" /> | ||
<Compile Include="AGaugeRangeCollection.cs" /> | ||
<Compile Include="Categories.cs" /> | ||
<Compile Include="NeedleType.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="ValueInRangeChangedEventArgs.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include=".editorconfig" /> | ||
<None Include="AGauge - FxCop.FxCop" /> | ||
<None Include="AGauge.nuspec" /> | ||
<None Include="..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
<None Include="..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> | ||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="AGauge.bmp" /> | ||
<None Update="AGauge.png"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent> | ||
</PostBuildEvent> | ||
<Description>Customizable WinForms gauge control - maintained by the NUTDotNet organization.</Description> | ||
<Authors>A. J. Bauer, with further work by Code Artist and others.</Authors> | ||
<Version /> | ||
<Company>NUTDotNet Organization</Company> | ||
<Copyright>Copyright © NUTDotNet 2023-2024</Copyright> | ||
<PackageProjectUrl>https://github.com/nutdotnet/AGauge</PackageProjectUrl> | ||
<PackageIcon>AGauge.png</PackageIcon> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/nutdotnet/AGauge.git</RepositoryUrl> | ||
<PackageTags>gauge, winforms, control</PackageTags> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<IncludeSymbols>True</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<PackageId>AGauge.Classic</PackageId> | ||
</PropertyGroup> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters