Skip to content

Commit

Permalink
chore: create build script (resolves #28 and #29)
Browse files Browse the repository at this point in the history
  • Loading branch information
warriordog committed Jul 14, 2024
1 parent c92b02b commit 31af454
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ riderModule.iml
/_ReSharper.Caches/
appsettings.Local.json
appsettings.Production.json
ModShark.sln.DotSettings.user
ModShark.sln.DotSettings.user
/Publish/
/Release/
40 changes: 40 additions & 0 deletions Resources/build-prod.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# [Production Build Script]
# This is a placeholder until proper CI/CD pipelines are built.

# Requirements:
# * Powershell
# * .NET SDK
# * EF Core Tools
# * Run from the solution root (not this folder)

# Notes:
# * https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli
# * https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.4
# * https://stackoverflow.com/questions/8095638/how-do-i-negate-a-condition-in-powershell
# * https://stackoverflow.com/a/71159216

$ReleaseVersion = '1.0.0-snapshot.0'
$ReleaseDir = './Release'
$PublishDir = './Publish'
$BuildConfig = 'Release'
$BuildProject = 'ModShark'

# Clean publish directory
if (Test-Path $PublishDir) {
rm -Recurse $PublishDir
mkdir $PublishDir
}

# Create release directory
if (-Not (Test-Path $ReleaseDir)) {
mkdir $ReleaseDir
}

# Publish build
dotnet clean $BuildProject --configuration $BuildConfig
dotnet publish $BuildProject --configuration $BuildConfig --output $PublishDir
dotnet ef migrations script --idempotent --project SharkeyDB --startup-project $BuildProject --output "$PublishDir/ModShark-migrations.sql"

# Package build
# Intentionally do *not* -Force in case someone forgets to update the release version.
Compress-Archive -Path "$PublishDir/*" -DestinationPath "$ReleaseDir/ModShark-$ReleaseVersion.zip"
Binary file modified contributing.md
Binary file not shown.

0 comments on commit 31af454

Please sign in to comment.