Skip to content

Commit 83a9b26

Browse files
Merge pull request #217 from ChrisPark89/dev
Add dev branch for versioning and deploying
2 parents ec77fdc + 9b643ea commit 83a9b26

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

Jenkinsfile

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
// The following property need to be set for the HTML report @TODO figure out how to get this nicely on jenkins
1414
//System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
1515

16-
/**
17-
* Release branches
18-
*/
19-
def RELEASE_BRANCHES = ["master"]
20-
21-
/**
22-
* Branches to send notifcations for
23-
*/
24-
def NOTIFY_BRANCHES = ["master"]
25-
26-
2716
/**
2817
* The following flags are switches to control which stages of the pipeline to be run. This is helpful when
2918
* testing a specific stage of the pipeline.
@@ -69,6 +58,22 @@ def SYSTEM_RESULTS = "${TEST_RESULTS_FOLDER}/system"
6958
*/
7059
def MASTER_BRANCH = "master"
7160

61+
/**
62+
* The name of the dev branch
63+
*/
64+
def DEV_BRANCH = "dev"
65+
66+
/**
67+
* Release branches
68+
*/
69+
def RELEASE_BRANCHES = [MASTER_BRANCH, DEV_BRANCH]
70+
71+
/**
72+
* Branches to send notifcations for
73+
*/
74+
def NOTIFY_BRANCHES = [MASTER_BRANCH, DEV_BRANCH]
75+
76+
7277
/**
7378
* Variables to check any new commit since the previous successful commit
7479
*/
@@ -94,7 +99,7 @@ def opts = []
9499

95100
// Setup a schedule to run build periodically
96101
// Run a build at 2.00AM everyday
97-
def CRON_STRING = BRANCH_NAME == MASTER_BRANCH ? "H 2 * * *" : ""
102+
def CRON_STRING = RELEASE_BRANCHES.contains(BRANCH_NAME) ? "H 2 * * *" : ""
98103

99104
if (RELEASE_BRANCHES.contains(BRANCH_NAME)) {
100105
// Only keep 20 builds
@@ -547,7 +552,7 @@ pipeline {
547552
return PIPELINE_CONTROL.deploy
548553
}
549554
expression {
550-
return BRANCH_NAME == MASTER_BRANCH
555+
return RELEASE_BRANCHES.contains(BRANCH_NAME)
551556
}
552557
expression {
553558
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
@@ -601,7 +606,7 @@ pipeline {
601606
return PIPELINE_CONTROL.deploy
602607
}
603608
expression {
604-
return BRANCH_NAME == MASTER_BRANCH
609+
return RELEASE_BRANCHES.contains(BRANCH_NAME)
605610
}
606611
expression {
607612
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
@@ -622,6 +627,9 @@ pipeline {
622627

623628
script {
624629
if (BRANCH_NAME == MASTER_BRANCH) {
630+
echo "publishing next to $TEST_NPM_REGISTRY"
631+
sh "npm publish --tag alpha"
632+
} else if (BRANCH_NAME == DEV_BRANCH) {
625633
echo "publishing next to $TEST_NPM_REGISTRY"
626634
sh "npm publish --tag next"
627635
} else {

0 commit comments

Comments
 (0)