File tree Expand file tree Collapse file tree 7 files changed +42
-11
lines changed
Expand file tree Collapse file tree 7 files changed +42
-11
lines changed Original file line number Diff line number Diff line change 1- # EditorConfig is awesome: https://EditorConfig.org
1+ # EditorConfig is awesome: https://EditorConfig.org
22
33# top-most EditorConfig file
44root = true
Original file line number Diff line number Diff line change 99env :
1010 CI_BUILD_NUMBER_BASE : ${{ github.run_number }}
1111 CI_TARGET_BRANCH : ${{ github.head_ref || github.ref_name }}
12+ PR_TRIGGER : ${{ github.event_name == 'pull_request' }}
1213
1314jobs :
1415 build :
1516
1617 # We need to run on Windows as we're supporting .NET Framework
1718 runs-on : windows-latest
1819
20+ permissions :
21+ contents : write
22+
1923 steps :
2024 - uses : actions/checkout@v5
21- - name : Setup .NET ${{ env.NET_VERSION }}
22- uses : actions/setup-dotnet@v4
25+ - name : Setup .NET
26+ uses : actions/setup-dotnet@v5
2327 with :
2428 dotnet-version : 10.0.x
2529 - name : Compute and set build number
2832 echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+1000))" >> $GITHUB_ENV
2933 - name : Build & Push
3034 env :
35+ PR_TRIGGER : ${{ env.PR_TRIGGER }}
3136 DOTNET_CLI_TELEMTRY_OPTOUT : true
3237 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
38+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3339 shell : pwsh
3440 run : |
3541 ./Build.ps1
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ dotnet --list-sdks
66Write-Output " build: Build started"
77
88Push-Location $PSScriptRoot
9+
10+ if ($env: PR_TRIGGER -eq " true" ) {
11+ $skipPackaging = $true
12+ } else {
13+ $skipPackaging = $false
14+ }
15+
916try {
1017 if (Test-Path .\artifacts) {
1118 Write-Output " build: Cleaning ./artifacts"
5764 Pop-Location
5865 }
5966
60- if ($env: NUGET_API_KEY ) {
61- # GitHub Actions will only supply this to branch builds and not PRs. We publish
62- # builds from any branch this action targets (i.e. master and dev).
63-
67+ if ($skipPackaging -eq $false ) {
6468 Write-Output " build: Publishing NuGet package"
6569
6670 foreach ($nupkg in Get-ChildItem artifacts/* .nupkg) {
7377
7478 iex " gh release create v$versionPrefix --title v$versionPrefix --generate-notes $ ( get-item ./ artifacts/* .nupkg) $ ( get-item ./ artifacts/* .snupkg) "
7579 }
80+ } else {
81+ Write-Output " build: Skipping publishing steps for PR build"
7682 }
7783} finally {
7884 Pop-Location
Original file line number Diff line number Diff line change 11<Solution >
2- <Folder Name =" /Docs/" >
2+ <Folder Name =" /assets/" >
3+ <File Path =" Build.ps1" />
4+ <File Path =" Directory.Build.props" />
5+ <File Path =" Directory.Version.props" />
6+ <File Path =" LICENSE" />
37 <File Path =" README.md" />
48 </Folder >
5- <Folder Name =" /Tests /" >
9+ <Folder Name =" /tests /" >
610 <Project Path =" tests/ByteGuard.FileValidator.Tests.Unit/ByteGuard.FileValidator.Tests.Unit.csproj" />
711 </Folder >
812 <Project Path =" src/ByteGuard.FileValidator/ByteGuard.FileValidator.csproj" />
Original file line number Diff line number Diff line change 1+ <Project >
2+ <Import Project =" Directory.Version.props" />
3+ <PropertyGroup >
4+ <LangVersion >latest</LangVersion >
5+ <TreatWarningsAsErrors >True</TreatWarningsAsErrors >
6+ <CheckEolTargetFramework >false</CheckEolTargetFramework >
7+ <Nullable >enable</Nullable >
8+ <ImplicitUsings >enable</ImplicitUsings >
9+ <GenerateDocumentationFile >true</GenerateDocumentationFile >
10+ <PublishRepositoryUrl >true</PublishRepositoryUrl >
11+ <EmbedUntrackedSources >true</EmbedUntrackedSources >
12+ <IncludeSymbols >true</IncludeSymbols >
13+ <SymbolPackageFormat >snupkg</SymbolPackageFormat >
14+ </PropertyGroup >
15+ </Project >
Original file line number Diff line number Diff line change 11<Project >
22 <PropertyGroup >
3- <VersionPrefix >1.0.0 </VersionPrefix >
3+ <VersionPrefix >1.0.1 </VersionPrefix >
44 </PropertyGroup >
55</Project >
Original file line number Diff line number Diff line change 11
2- # ByteGuard File Validator
2+ # ByteGuard File Validator ![ NuGet Version ] ( https://img.shields.io/nuget/v/ByteGuard.FileValidator )
33
44** ByteGuard.FileValidator** is a lightweight security-focused library for validating user-supplied files in .NET applications.
55It helps you enforce consistent file upload rules by checking:
You can’t perform that action at this time.
0 commit comments