Skip to content

Commit cac659b

Browse files
committed
Build-Workflow
1 parent c2fd93a commit cac659b

12 files changed

Lines changed: 180 additions & 3 deletions

File tree

.github/workflows/Build.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: [ "main" ]
8+
9+
workflow_call:
10+
outputs:
11+
version:
12+
value: ${{ jobs.build.outputs.version }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
outputs:
19+
version: ${{ steps.version.outputs.version }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Install .NET 8
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: 8.0.x
31+
32+
- name: Get next version
33+
id: version
34+
uses: reecetech/version-increment@2023.10.2
35+
36+
- name: Build
37+
run: |
38+
dotnet build -c Release -p:Version=${{ steps.version.outputs.version }}
39+
40+
- name: Upload PackScan.PackagesProvider.Abstractions
41+
uses: actions/upload-artifact@v4.3.1
42+
with:
43+
name: PackScan.PackagesProvider.Abstractions.${{ steps.version.outputs.version }}.nupkg
44+
path: artifacts/PackScan.PackagesProvider.Abstractions.${{ steps.version.outputs.version }}.nupkg
45+
if-no-files-found: error
46+
47+
- name: Upload PackScan.Analyzer
48+
uses: actions/upload-artifact@v4.3.1
49+
with:
50+
name: PackScan.Analyzer.${{ steps.version.outputs.version }}.nupkg
51+
path: artifacts/PackScan.Analyzer.${{ steps.version.outputs.version }}.nupkg
52+
if-no-files-found: error
53+
54+
- name: Upload PackScan.Defaults
55+
uses: actions/upload-artifact@v4.3.1
56+
with:
57+
name: PackScan.Defaults.${{ steps.version.outputs.version }}.nupkg
58+
path: artifacts/PackScan.Defaults.${{ steps.version.outputs.version }}.nupkg
59+
if-no-files-found: error
60+
61+
- name: Upload PackScan.Tool
62+
uses: actions/upload-artifact@v4.3.1
63+
with:
64+
name: PackScan.Tool.${{ steps.version.outputs.version }}.nupkg
65+
path: artifacts/PackScan.Tool.${{ steps.version.outputs.version }}.nupkg
66+
if-no-files-found: error
67+
68+
test:
69+
runs-on: ubuntu-latest
70+
71+
strategy:
72+
matrix:
73+
include:
74+
- dotnet-version: 3.1.x
75+
dotnet-framework: netcoreapp3.1
76+
77+
- dotnet-version: 5.0.x
78+
dotnet-framework: net5.0
79+
80+
- dotnet-version: 6.0.x
81+
dotnet-framework: net6.0
82+
83+
- dotnet-version: 7.0.x
84+
dotnet-framework: net7.0
85+
86+
- dotnet-version: 8.0.x
87+
dotnet-framework: net8.0
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Install .NET
94+
uses: actions/setup-dotnet@v4
95+
with:
96+
dotnet-version: ${{ matrix.dotnet-version }}
97+
98+
- name: Run Tests
99+
run: |
100+
dotnet test -f ${{ matrix.dotnet-framework }} -c Release

.github/workflows/Release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build:
11+
uses: ./.github/workflows/Build.yml
12+
13+
release:
14+
needs: build
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkup code
19+
uses: actions/checkout@v4.1.1
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Download Artifacts
24+
uses: actions/download-artifact@v4
25+
with:
26+
path: artifacts
27+
pattern: PackScan.*.nupkg
28+
merge-multiple: true
29+
30+
- name: Install NuGet Validator
31+
run: |
32+
dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
33+
dotnet tool restore
34+
35+
- name: Validate NuGet Packages
36+
run: |
37+
files=$(ls artifacts/PackScan.*.nupkg)
38+
dotnet meziantou.validate-nuget-package $files --excluded-rules Symbols
39+
40+
- name: Create version tag
41+
run: |
42+
git config user.name "GitHub Action"
43+
git config user.email "<>"
44+
git tag v${{ needs.build.outputs.version }}
45+
git push origin v${{ needs.build.outputs.version }}
46+
47+
- name: Create Release
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
gh release create v${{ needs.build.outputs.version }}
52+
53+
- name: Upload Release Binaries
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
files=$(ls artifacts/PackScan.*.nupkg)
58+
gh release upload v${{ needs.build.outputs.version }} $files

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ BenchmarkDotNet.Artifacts/
6060
# .NET Core
6161
project.lock.json
6262
project.fragment.lock.json
63-
artifacts/
63+
artifacts/*
64+
!artifacts/.gitkeep
6465

6566
# ASP.NET Scaffolding
6667
ScaffoldingReadMe.txt

Icon.png

4.03 KB
Loading

PackScan.sln

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 17
43
VisualStudioVersion = 17.6.33626.354
@@ -15,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1514
build.ps1 = build.ps1
1615
Directory.Build.props = Directory.Build.props
1716
global.json = global.json
17+
Icon.png = Icon.png
1818
LICENSE = LICENSE
1919
nuget.config = nuget.config
2020
ReadMe.md = ReadMe.md
@@ -40,6 +40,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{F9F7EE5C-D
4040
EndProject
4141
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackScan.Defaults", "src\PackScan.Defaults\PackScan.Defaults.csproj", "{09F68765-D0A7-4522-85AE-F3B66E3562C0}"
4242
EndProject
43+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{B417386C-0789-42CA-B211-4931D21F641F}"
44+
EndProject
45+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{E4996529-1814-4CF7-951D-517AAECC5530}"
46+
ProjectSection(SolutionItems) = preProject
47+
.github\workflows\Build.yml = .github\workflows\Build.yml
48+
.github\workflows\Release.yml = .github\workflows\Release.yml
49+
EndProjectSection
50+
EndProject
4351
Global
4452
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4553
Debug|Any CPU = Debug|Any CPU
@@ -86,6 +94,8 @@ Global
8694
{8F2E4832-2A8E-46CB-98F8-3ECE0F45CF3D} = {F9F7EE5C-DD30-439B-ABB0-33947D2C833B}
8795
{19E1358B-9100-4905-BA7B-A38A6C29E723} = {1EF8F5B9-DD77-4162-A819-85A2B49FED7B}
8896
{167D32AA-CBBC-4772-9898-41A69A17AED8} = {B4BAADD5-BEF6-4D5B-9CB6-48C85D7D5D06}
97+
{B417386C-0789-42CA-B211-4931D21F641F} = {40512514-8795-4C6A-A58F-6AFC87C17B2F}
98+
{E4996529-1814-4CF7-951D-517AAECC5530} = {B417386C-0789-42CA-B211-4931D21F641F}
8999
{F9F7EE5C-DD30-439B-ABB0-33947D2C833B} = {1EF8F5B9-DD77-4162-A819-85A2B49FED7B}
90100
{09F68765-D0A7-4522-85AE-F3B66E3562C0} = {1EF8F5B9-DD77-4162-A819-85A2B49FED7B}
91101
EndGlobalSection

artifacts/.gitkeep

Whitespace-only changes.

src/NuGet.Metadata.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<Project>
22

33
<PropertyGroup>
4-
<Version>0.3.1</Version>
54
<Authors>Loop8ack</Authors>
65
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
76
<PackageLicenseExpression>MIT</PackageLicenseExpression>
87
<RepositoryUrl>https://github.com/loop8ack/PackScan</RepositoryUrl>
98
<PackageId>$(MsBuildProjectName)</PackageId>
9+
<PackageIcon>Icon.png</PackageIcon>
10+
<PackageVersion>$(Version)</PackageVersion>
1011
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
1112
<PackageTags>msbuild;package;generator</PackageTags>
1213
<NeutralLanguage>en</NeutralLanguage>
14+
<PackageOutputPath>$(MSBuildThisFileDirectory)\..\artifacts</PackageOutputPath>
1315
<Copyright>Copyright $([System.DateTime]::Now.ToString(yyyy)) $(Authors)</Copyright>
1416
<Description>Simplify package information retrieval and license compliance in your .NET projects. Access comprehensive package details, including dependencies, icons, license texts, ReadMe content, release notes and more directly from your code.</Description>
1517
</PropertyGroup>
1618

1719
<ItemGroup>
1820
<Content Include="$(MSBuildThisFileDirectory)\..\LICENSE" PackagePath="\" Visible="false" Pack="true" />
21+
<Content Include="$(MSBuildThisFileDirectory)\..\Icon.png" PackagePath="\" Visible="false" Pack="true" />
1922
<Content Include="$(MSBuildThisFileDirectory)\..\ReadMe.md" PackagePath="\" Visible="false" Pack="true" />
2023
</ItemGroup>
2124

src/PackScan.Analyzer/PackScan.Analyzer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<IsRoslynComponent>true</IsRoslynComponent>
1313
<NoWarn>$(NoWarn);NU5128</NoWarn>
1414
<DefineConstants>$(DefineConstants);PackScan_Analyzer</DefineConstants>
15+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1516
</PropertyGroup>
1617

1718
<ItemGroup>

src/PackScan.Defaults/PackScan.Defaults.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
88
<DevelopmentDependency>true</DevelopmentDependency>
9+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
910
</PropertyGroup>
1011

1112
<ItemGroup>

src/PackScan.PackagesProvider.Abstractions/PackScan.PackagesProvider.Abstractions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<RootNamespace>PackScan.PackagesProvider</RootNamespace>
9+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
910
</PropertyGroup>
1011

1112
</Project>

0 commit comments

Comments
 (0)