Skip to content

Commit

Permalink
build: test nupkg locally bash and powerhell
Browse files Browse the repository at this point in the history
  • Loading branch information
solrevdev committed Jul 7, 2023
1 parent 77a01f2 commit de3bd26
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
35 changes: 35 additions & 0 deletions build/test-local.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env pwsh

$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$scriptDir = Split-Path -Path $scriptDir -Parent

Set-Location -Path $scriptDir

# Clean and build the project
dotnet clean .\solrevdev.seedfolder.sln
dotnet restore .\solrevdev.seedfolder.sln
dotnet build .\solrevdev.seedfolder.sln

# Create an artifact folder
$null = New-Item -Path .\artifacts -ItemType Directory -Force

# Remove any old nupkg files
Remove-Item -Path .\artifacts\nupkg\* -Recurse -Force

# Package the dotnet tool
dotnet pack .\solrevdev.seedfolder.sln -c Release -o .\artifacts\nupkg

# Uninstall any version you currently have installed
dotnet tool uninstall -g solrevdev.seedfolder

# Install the version we have just built and packaged
dotnet tool install -g --add-source .\artifacts\nupkg solrevdev.seedfolder

# Run the tool
seedfolder --help

# Now uninstall the tool ready for the next run
dotnet tool uninstall -g solrevdev.seedfolder

# And install it again from nuget
dotnet tool install -g solrevdev.seedfolder
33 changes: 33 additions & 0 deletions build/test-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# shellcheck disable=SC2046
cd $(dirname "$0") || exit

# clean and build the project
dotnet clean ../solrevdev.seedfolder.sln
dotnet restore ../solrevdev.seedfolder.sln
dotnet build ../solrevdev.seedfolder.sln

# create an artifact folder
mkdir -p ../artifacts

# remove any old nupkg files
rm -rf ../artifacts/nupkg

# package the dotnet tool
dotnet pack ../solrevdev.seedfolder.sln -c release -o ../artifacts/nupkg

# uninstall any version you currently have installed
dotnet tool uninstall -g solrevdev.seedfolder

# install the version we have just built and packaged
dotnet tool install -g --add-source ../artifacts/nupkg solrevdev.seedfolder

# run the tool
seedfolder --help

# now uninstall the tool ready for the next run
dotnet tool uninstall -g solrevdev.seedfolder

# and install it again from nuget
dotnet tool install -g solrevdev.seedfolder

0 comments on commit de3bd26

Please sign in to comment.