Skip to content

Commit 8e6ff86

Browse files
committed
Should deploy now
1 parent cf8c474 commit 8e6ff86

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[![Build status](https://ci.appveyor.com/api/projects/status/dvuw4ggx543nx3h7?svg=true)](https://ci.appveyor.com/project/snazy2000/snipeitps)

SnipeItPS.build.ps1

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ task GenerateRelease CreateHelp, {
134134
# Copy module
135135
Copy-Item -Path "$BuildRoot\SnipeitPS\*" -Destination "$releasePath\SnipeitPS" -Recurse -Force
136136
# Copy additional files
137-
#$additionalFiles = @(
138-
# "$BuildRoot\CHANGELOG.md"
137+
$additionalFiles = @(
138+
"$BuildRoot\CHANGELOG.md"
139139
#"$BuildRoot\LICENSE"
140-
#"$BuildRoot\README.md"
141-
#)
142-
#Copy-Item -Path $additionalFiles -Destination "$releasePath\SnipeitPS" -Force
140+
"$BuildRoot\README.md"
141+
)
142+
Copy-Item -Path $additionalFiles -Destination "$releasePath\SnipeitPS" -Force
143143
}
144144

145145
# Synopsis: Update the manifest of the module
@@ -183,6 +183,40 @@ task ConvertMarkdown -Partial @ConvertMarkdown InstallPandoc, {process {
183183
}, RemoveMarkdownFiles
184184
# endregion
185185

186+
# region publish
187+
task Deploy -If (
188+
# Only deploy if the master branch changes
189+
$env:APPVEYOR_REPO_BRANCH -eq 'master' -and
190+
# Do not deploy if this is a pull request (because it hasn't been approved yet)
191+
(-not ($env:APPVEYOR_PULL_REQUEST_NUMBER)) -and
192+
# Do not deploy if the commit contains the string "skip-deploy"
193+
# Meant for major/minor version publishes with a .0 build/patch version (like 2.1.0)
194+
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*'
195+
) {
196+
Remove-Module SnipeitPS -ErrorAction SilentlyContinue
197+
}, PublishToGallery
198+
199+
task PublishToGallery {
200+
assert ($env:PSGalleryAPIKey) "No key for the PSGallery"
201+
202+
Import-Module $releasePath\SnipeitPS\SnipeitPS.psd1 -ErrorAction Stop
203+
Publish-Module -Name SnipeitPS -NuGetApiKey $env:PSGalleryAPIKey
204+
}
205+
206+
# Synopsis: Push with a version tag.
207+
task PushRelease GitStatus, GetVersion, {
208+
# Done in appveyor.yml with deploy provider.
209+
# This is needed, as I don't know how to athenticate (2-factor) in here.
210+
exec { git checkout master }
211+
$changes = exec { git status --short }
212+
assert (!$changes) "Please, commit changes."
213+
214+
exec { git push }
215+
exec { git tag -a "v$Version" -m "v$Version" }
216+
exec { git push origin "v$Version" }
217+
}
218+
# endregion
219+
186220
#region Cleaning tasks
187221
task Clean RemoveGeneratedFiles
188222

0 commit comments

Comments
 (0)