Skip to content

Commit deaba3d

Browse files
authored
cleaup merge [skip ci]
cleanup
2 parents d345244 + 2f841c3 commit deaba3d

File tree

7 files changed

+42
-11
lines changed

7 files changed

+42
-11
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# EditorConfig is awesome: https://EditorConfig.org
1+
# EditorConfig is awesome: https://EditorConfig.org
22

33
# top-most EditorConfig file
44
root = true

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ on:
99
env:
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

1314
jobs:
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
@@ -28,8 +32,10 @@ jobs:
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

Build.ps1

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ dotnet --list-sdks
66
Write-Output "build: Build started"
77

88
Push-Location $PSScriptRoot
9+
10+
if($env:PR_TRIGGER -eq "true") {
11+
$skipPackaging = $true
12+
} else {
13+
$skipPackaging = $false
14+
}
15+
916
try {
1017
if(Test-Path .\artifacts) {
1118
Write-Output "build: Cleaning ./artifacts"
@@ -57,10 +64,7 @@ try {
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) {
@@ -73,6 +77,8 @@ try {
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

ByteGuard.FileValidator.slnx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
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" />

Directory.Build.props

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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>

Directory.Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>1.0.0</VersionPrefix>
3+
<VersionPrefix>1.0.1</VersionPrefix>
44
</PropertyGroup>
55
</Project>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.
55
It helps you enforce consistent file upload rules by checking:

0 commit comments

Comments
 (0)