File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments