Skip to content

Commit d299096

Browse files
committed
Merge pull request #119 from guillermooo-forks/new-publish-script
add basic publish script
2 parents 070c7d6 + 52a56df commit d299096

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

bin/Publish.ps1

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<#
2+
.DESCRIPTION
3+
Publishes to 'master' after deleting dev files.
4+
#>
5+
6+
param([string]$Tag)
7+
8+
function AbortIfProcessFailed {
9+
param([string]$message)
10+
if ($LASTEXITCODE) { throw $message }
11+
exit $LASTEXITCODE
12+
}
13+
14+
function AbortIfDirtyWorkingDirectory {
15+
if (@(git status --short).Count -ne 0) {
16+
throw "uncommited changes "
17+
exit 1
18+
}
19+
}
20+
21+
function AbortIfGitNotAvailable {
22+
get-command git -erroraction stop > $null
23+
}
24+
25+
$toDelete = @(
26+
"manifest.json",
27+
"tests",
28+
"bin"
29+
)
30+
31+
AbortIfGitNotAvailable
32+
AbortIfDirtyWorkingDirectory
33+
34+
try {
35+
push-location $PSScriptRoot\..
36+
37+
remove-item -recurse $toDelete
38+
39+
write-warning "commit the files, tag and push upstream"
40+
git checkout master
41+
AbortIfProcessFailed "could not checkout branch master"
42+
}
43+
finally {
44+
pop-location
45+
}
46+

0 commit comments

Comments
 (0)