File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-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
+ function AbortIfNotOnMaster {
26
+ if (@ (git branch | select-string " * master" - simplematch).Count -eq 0 ) {
27
+ throw " not on 'master' branch"
28
+ exit 1
29
+ }
30
+ }
31
+
32
+ $toDelete = @ (
33
+ " manifest.json" ,
34
+ " tests" ,
35
+ " bin"
36
+ )
37
+
38
+ AbortIfGitNotAvailable
39
+ AbortIfDirtyWorkingDirectory
40
+ AbortIfNotOnMaster
41
+
42
+ try {
43
+ push-location $PSScriptRoot \..
44
+
45
+ remove-item - recurse $toDelete - exclude " Publish.ps1" - whatif
46
+
47
+ write-warning " commit the files, tag and push upstream"
48
+ }
49
+ finally {
50
+ pop-location
51
+ }
52
+
You can’t perform that action at this time.
0 commit comments