Skip to content

Commit

Permalink
adding deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed Nov 7, 2023
1 parent 61979e5 commit f40b793
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Update-ModuleManifest -RequiredModules @(

if (-not $SkipScriptAnalyzer) {
Write-Host "Invoke-ScriptAnalyzer with -Fixfor $PsdPath"
Invoke-ScriptAnalyzer $PsdPath -Recurse -Settings PSGallery -Fix -ErrorAction Stop
Invoke-ScriptAnalyzer $PsdPath -Settings PSGallery -Fix -ErrorAction Stop
}

$OldModule = Get-Module $ModuleName -ErrorAction SilentlyContinue
Expand Down
16 changes: 12 additions & 4 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Version Numbers

Version numbers are managed by GitVersion. When building locally, the version number generated by `Build.ps1`. When building in GitHub Actions, the version number is set using the latest tag.

# Building and Deploying F7History

To build locally:

```ps1
.\Build.ps1
.\Build.ps1 -Verbose -SkipScriptAnalyzer -Version 1.4.1
```

This will create the `./Output/F7History` folder containing the module, build the module, publish it to a local repository (`-Repository -local`), and import it into the current PowerShell session. To create the local repository, run this command:
* `-Verbose` -duh
* `-SkipScriptAnalyzer` - Skips ScriptAnalyzer. This is useful when you are developing and don't want to wait for ScriptAnalyzer to run.
* `-Version` - Sets the version number. If not specified, the version number is generated by GitVersion.

`Build.ps1` will create the `./Output/F7History` folder containing the module, build the module, publish it to a local repository (`-Repository -local`), and import it into the current PowerShell session. To create the local repository, run this command:

```ps1
Register-PSRepository -Name local -SourceLocation "~/psrepo" -InstallationPolicy Trusted
Expand All @@ -20,9 +28,10 @@ To test:

## Build & Test Locally with specific Terminal.Gui and ConsoleGuiTools versions

The `build.ps1` script will use the latest version of `Terminal.Gui` and `ConsoleGuiTools` from the PowerShell Gallery by default. To build and test with a specific of `ConsoleGuiTools` publish it to the local repository first (you have to setup a local repository first):
The `Build.ps1` script will use the latest version of `ConsoleGuiTools` from the PowerShell Gallery by default. To build and test with a specific version of `ConsoleGuiTools` publish it to the local repository first (you have to setup a local repository first):

```ps1
# In the ConsoleGuiTools folder...
Publish-Module -Path .\ConsoleGuiTools -Repository local
```

Expand All @@ -33,7 +42,6 @@ If `Build.ps1` finds a local repository it will use it instead of the PowerShell
The module is published to the PowerShell Gallery using GitHub Actions. See the publish.yml GitHub Action for details.

1) Merge changes to the `main` branch, or push directly to `main`. The GitHub Action will build the module, but not publish it.

2) Add and push a new tag

```ps1
Expand Down
18 changes: 18 additions & 0 deletions Deploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Script for deploying module via github actions
# If -Version is not specified, it will use the output from gitversion
# and remove the build number and add 1 to the revision number
param(
[parameter(Mandatory = $false)]
[String]
$Version
)

$ModuleName = "F7History"
if ($null -eq $Version -or "" -eq $Version) {
$prevVersion = dotnet-gitversion /showvariable MajorMinorPatch
$build = dotnet-gitversion /showvariable BuildMetaData
"Got build from dotnet-gitversion: $build"
$Version = "$($prevVersion).$($build)"
"Got version from dotnet-gitversion: $Version"
}

1 change: 0 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mode: MainLine
next-version: 1.4.0
assembly-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILDCOUNT ?? 0}'
assembly-informational-format: '{NuGetVersionV2}+Build.{env:BUILDCOUNT ?? 0}.Date.{CommitDate}.Branch.{env:SAFEBRANCHNAME ?? unknown}.Sha.{Sha}'
major-version-bump-message: '\+?semver:\s?(breaking|major)'
Expand Down
6 changes: 3 additions & 3 deletions Source/F7History.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Windows','Mac','Linux','History','ConsoleGuiTools','TUI','Out-ConsoleGridView','ocgv','Terminal.Gui','gui.cs'
Tags = 'History','Windows','Mac','Linux','History','ConsoleGuiTools','TUI','Out-ConsoleGridView','ocgv','Terminal.Gui','gui.cs'

# A URL to the license for this module.
LicenseUri = 'https://github.com/gui-cs/F7History/blob/main/LICENSE.md'
Expand All @@ -108,7 +108,7 @@ PrivateData = @{
IconUri = 'https://gui-cs.github.io/Terminal.Gui/images/logo48.png'

# ReleaseNotes of this module
# ReleaseNotes = ''
ReleaseNotes = 'https://github.com/gui-cs/F7History/releases'

# Prerelease string of this module
# Prerelease = ''
Expand All @@ -124,7 +124,7 @@ PrivateData = @{
} # End of PrivateData hashtable

# HelpInfo URI of this module
HelpInfoURI = 'https://github.com/gui-cs/F7History/blob/main/README.md'
HelpInfoURI = 'https://github.com/gui-cs/F7History'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
Expand Down

0 comments on commit f40b793

Please sign in to comment.