Skip to content

Commit 750a432

Browse files
committed
Use publish script and update README
1 parent cdc9171 commit 750a432

File tree

5 files changed

+42
-94
lines changed

5 files changed

+42
-94
lines changed
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nuget Pack
1+
name: Build and Test
22

33
on:
44
push:
@@ -18,29 +18,23 @@ jobs:
1818
with:
1919
dotnet-version: 9.0.x
2020

21-
- name: Restore dependencies
22-
run: dotnet restore
23-
24-
- name: Build library
25-
run: dotnet build
26-
2721
- name: Run tests
2822
run: dotnet test
2923

30-
- name: Pack
31-
run: dotnet pack
24+
- name: Run publish script
25+
run: ./publish-nix.sh -d
3226

33-
- name: Upload build
27+
- name: Upload package
3428
uses: actions/upload-artifact@v4
3529
with:
3630
name: 'Nuget Package'
37-
path: 'BinaryObjectScanner/bin/Release/*.nupkg'
31+
path: '*.nupkg'
3832

3933
- name: Upload to rolling
4034
uses: ncipollo/[email protected]
4135
with:
4236
allowUpdates: True
43-
artifacts: 'BinaryObjectScanner/bin/Release/*.nupkg'
37+
artifacts: "*.nupkg,*.zip"
4438
body: 'Last built commit: ${{ github.sha }}'
4539
name: 'Rolling Release'
4640
prerelease: True

.github/workflows/build_programs.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Binary Object Scanner
22

3-
[![Program Build](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_programs.yml/badge.svg)](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_programs.yml)
4-
[![Nuget Pack](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_nupkg.yml/badge.svg)](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_nupkg.yml)
3+
[![Build and Test](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/SabreTools/BinaryObjectScanner/actions/workflows/build_and_test.yml)
54

65
C# protection, packer, and archive scanning library. This currently compiles as a library so it can be used in any C# application. Two reference applications called `ProtectionScan` and `ExtractionTool` are also included to demonstrate the abilities of the library. For an example of a program implementing the library, see [MPF](https://github.com/SabreTools/MPF).
76

publish-nix.sh

100644100755
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010

1111
# Optional parameters
1212
USE_ALL=false
13+
INCLUDE_DEBUG=false
1314
NO_BUILD=false
1415
NO_ARCHIVE=false
15-
while getopts "uba" OPTION; do
16+
while getopts "udba" OPTION; do
1617
case $OPTION in
1718
u)
1819
USE_ALL=true
1920
;;
21+
d)
22+
INCLUDE_DEBUG=true
23+
;;
2024
b)
2125
NO_BUILD=true
2226
;;
@@ -39,6 +43,7 @@ COMMIT=$(git log --pretty=%H -1)
3943
# Output the selected options
4044
echo "Selected Options:"
4145
echo " Use all frameworks (-u) $USE_ALL"
46+
echo " Include debug builds (-d) $INCLUDE_DEBUG"
4247
echo " No build (-b) $NO_BUILD"
4348
echo " No archive (-a) $NO_ARCHIVE"
4449
echo " "
@@ -93,14 +98,14 @@ if [ $NO_BUILD = false ]; then
9398

9499
# Only .NET 5 and above can publish to a single file
95100
if [[ $(echo ${SINGLE_FILE_CAPABLE[@]} | fgrep -w $FRAMEWORK) ]]; then
96-
# Only include Debug if building all
97-
if [ $USE_ALL = true ]; then
101+
# Only include Debug if set
102+
if [ $INCLUDE_DEBUG = true ]; then
98103
dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
99104
fi
100105
dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
101106
else
102-
# Only include Debug if building all
103-
if [ $USE_ALL = true ]; then
107+
# Only include Debug if set
108+
if [ $INCLUDE_DEBUG = true ]; then
104109
dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
105110
fi
106111
dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
@@ -132,14 +137,14 @@ if [ $NO_BUILD = false ]; then
132137

133138
# Only .NET 5 and above can publish to a single file
134139
if [[ $(echo ${SINGLE_FILE_CAPABLE[@]} | fgrep -w $FRAMEWORK) ]]; then
135-
# Only include Debug if building all
136-
if [ $USE_ALL = true ]; then
140+
# Only include Debug if set
141+
if [ $INCLUDE_DEBUG = true ]; then
137142
dotnet publish ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
138143
fi
139144
dotnet publish ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
140145
else
141-
# Only include Debug if building all
142-
if [ $USE_ALL = true ]; then
146+
# Only include Debug if set
147+
if [ $INCLUDE_DEBUG = true ]; then
143148
dotnet publish ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
144149
fi
145150
dotnet publish ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
@@ -172,8 +177,8 @@ if [ $NO_ARCHIVE = false ]; then
172177
fi
173178
fi
174179

175-
# Only include Debug if building all
176-
if [ $USE_ALL = true ]; then
180+
# Only include Debug if set
181+
if [ $INCLUDE_DEBUG = true ]; then
177182
cd $BUILD_FOLDER/ExtractionTool/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
178183
if [[ $(echo ${NON_DLL_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
179184
zip -r $BUILD_FOLDER/ExtractionTool_${FRAMEWORK}_${RUNTIME}_debug.zip . -x 'CascLib.dll' -x 'mspack.dll' -x 'StormLib.dll'
@@ -216,8 +221,8 @@ if [ $NO_ARCHIVE = false ]; then
216221
fi
217222
fi
218223

219-
# Only include Debug if building all
220-
if [ $USE_ALL = true ]; then
224+
# Only include Debug if set
225+
if [ $INCLUDE_DEBUG = true ]; then
221226
cd $BUILD_FOLDER/ProtectionScan/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
222227
if [[ $(echo ${NON_DLL_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
223228
zip -r $BUILD_FOLDER/ProtectionScan_${FRAMEWORK}_${RUNTIME}_debug.zip . -x 'CascLib.dll' -x 'mspack.dll' -x 'StormLib.dll'

publish-win.ps1

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ param(
1212
[Alias("UseAll")]
1313
[switch]$USE_ALL,
1414

15+
[Parameter(Mandatory = $false)]
16+
[Alias("IncludeDebug")]
17+
[switch]$INCLUDE_DEBUG,
18+
1519
[Parameter(Mandatory = $false)]
1620
[Alias("NoBuild")]
1721
[switch]$NO_BUILD,
@@ -30,6 +34,7 @@ $COMMIT = git log --pretty=format:"%H" -1
3034
# Output the selected options
3135
Write-Host "Selected Options:"
3236
Write-Host " Use all frameworks (-UseAll) $USE_ALL"
37+
Write-Host " Include debug builds (-IncludeDebug) $INCLUDE_DEBUG"
3338
Write-Host " No build (-NoBuild) $NO_BUILD"
3439
Write-Host " No archive (-NoArchive) $NO_ARCHIVE"
3540
Write-Host " "
@@ -80,15 +85,15 @@ if (!$NO_BUILD.IsPresent) {
8085

8186
# Only .NET 5 and above can publish to a single file
8287
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
83-
# Only include Debug if building all
84-
if ($USE_ALL.IsPresent) {
88+
# Only include Debug if set
89+
if ($INCLUDE_DEBUG.IsPresent) {
8590
dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
8691
}
8792
dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
8893
}
8994
else {
90-
# Only include Debug if building all
91-
if ($USE_ALL.IsPresent) {
95+
# Only include Debug if set
96+
if ($INCLUDE_DEBUG.IsPresent) {
9297
dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
9398
}
9499
dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
@@ -116,15 +121,15 @@ if (!$NO_BUILD.IsPresent) {
116121

117122
# Only .NET 5 and above can publish to a single file
118123
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
119-
# Only include Debug if building all
120-
if ($USE_ALL.IsPresent) {
124+
# Only include Debug if set
125+
if ($INCLUDE_DEBUG.IsPresent) {
121126
dotnet publish ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
122127
}
123128
dotnet publish ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
124129
}
125130
else {
126-
# Only include Debug if building all
127-
if ($USE_ALL.IsPresent) {
131+
# Only include Debug if set
132+
if ($INCLUDE_DEBUG.IsPresent) {
128133
dotnet publish ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
129134
}
130135
dotnet publish ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
@@ -153,8 +158,8 @@ if (!$NO_ARCHIVE.IsPresent) {
153158
continue
154159
}
155160

156-
# Only include Debug if building all
157-
if ($USE_ALL.IsPresent) {
161+
# Only include Debug if set
162+
if ($INCLUDE_DEBUG.IsPresent) {
158163
Set-Location -Path $BUILD_FOLDER\ExtractionTool\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
159164
if ($NON_DLL_FRAMEWORKS -contains $FRAMEWORK -or $NON_DLL_RUNTIMES -contains $RUNTIME) {
160165
7z a -tzip -x'!CascLib.dll' -x'!mspack.dll' -x'!StormLib.dll' $BUILD_FOLDER\ExtractionTool_${FRAMEWORK}_${RUNTIME}_debug.zip *
@@ -192,8 +197,8 @@ if (!$NO_ARCHIVE.IsPresent) {
192197
continue
193198
}
194199

195-
# Only include Debug if building all
196-
if ($USE_ALL.IsPresent) {
200+
# Only include Debug if set
201+
if ($INCLUDE_DEBUG.IsPresent) {
197202
Set-Location -Path $BUILD_FOLDER\ProtectionScan\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
198203
if ($NON_DLL_FRAMEWORKS -contains $FRAMEWORK -or $NON_DLL_RUNTIMES -contains $RUNTIME) {
199204
7z a -tzip -x'!CascLib.dll' -x'!mspack.dll' -x'!StormLib.dll' $BUILD_FOLDER\ProtectionScan_${FRAMEWORK}_${RUNTIME}_debug.zip *

0 commit comments

Comments
 (0)