File tree Expand file tree Collapse file tree 5 files changed +125
-1
lines changed
Expand file tree Collapse file tree 5 files changed +125
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Script for updating cdnVersion of angular.js
4+
5+ echo " ###################################"
6+ echo " ## Update angular.js cdnVersion ###"
7+ echo " ###################################"
8+
9+ ARG_DEFS=(
10+ " --cdn-version=(.*)"
11+ " --action=(prepare|publish)"
12+ )
13+
14+ function init {
15+ cd ../..
16+ }
17+
18+ function prepare {
19+ replaceJsonProp " package.json" " cdnVersion" " (.*)" " $CDN_VERSION "
20+ git add package.json
21+ git commit -m " chore(release): update cdn version"
22+ }
23+
24+ function publish {
25+ BRANCH=$( git rev-parse --abbrev-ref HEAD)
26+ # push the commits to github
27+ git push origin $BRANCH
28+ }
29+
30+ source $( dirname $0 ) /../utils.inc
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # Script for updating angularjs.org repo
3+
4+ echo " #################################"
5+ echo " ##### Update angularjs.org ######"
6+ echo " #################################"
7+
8+ ARG_DEFS=(
9+ " --action=(prepare|publish)"
10+ " --cdn-version=(.*)"
11+ )
12+
13+ function init {
14+ TMP_DIR=$( resolveDir ../../tmp)
15+ REPO_DIR=$TMP_DIR /angularjs.org
16+ }
17+
18+ function prepare {
19+ echo " -- Cloning angularjs.org"
20+ git clone git@github.com:angular/angularjs.org.git $REPO_DIR
21+
22+ #
23+ # update files
24+ #
25+ echo " -- Updating angularjs.org"
26+ cd $REPO_DIR
27+ VERSION_REGEX=" [a-z0-9\-\.\+]+"
28+
29+ replaceInFile " index.html" " (ajax\/libs\/angularjs\/)$VERSION_REGEX " " \1$CDN_VERSION "
30+ replaceInFile " index.html" " (<span class=\" version\" >[^<]*<span>)$VERSION_REGEX " " \1$CDN_VERSION "
31+ replaceInFile " index.html" " (code.angularjs.org\/)$VERSION_REGEX " " \1$CDN_VERSION "
32+
33+ replaceInFile " js/homepage.js" " ($scope .CURRENT_STABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX " " \1$CDN_VERSION "
34+ replaceInFile " js/homepage.js" " ($scope .CURRENT_UNSTABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX " " \1$CDN_VERSION "
35+
36+ git add index.html
37+ git add js/homepage.js
38+ git commit -m " update(version): update angular version to $CDN_VERSION "
39+ }
40+
41+ function publish {
42+ cd $REPO_DIR
43+ echo " -- Pushing angularjs.org"
44+ git push origin master
45+ }
46+
47+ source $( dirname $0 ) /../utils.inc
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ ARG_DEFS=(
4+ # require the git dryrun flag so the script can't be run without
5+ # thinking about this!
6+ " --git-push-dryrun=(true|false)"
7+ )
8+
9+ function findLatestRelease {
10+ # returns e.g. v1.2.7
11+ LATEST_TAG=$( git describe --abbrev=0 --tags)
12+ # returns e.g. 1.2.7
13+ echo ${LATEST_TAG: 1}
14+ }
15+
16+ function init {
17+ NG_ARGS=(" $@ " )
18+ if [[ ! $VERBOSE ]]; then
19+ VERBOSE=false
20+ fi
21+ VERBOSE_ARG=" --verbose=$VERBOSE "
22+ }
23+
24+ function phase {
25+ ACTION_ARG=" --action=$1 "
26+ CDN_VERSION_ARG=" --cdn-version=$LATEST_VERSION "
27+ ./scripts/angular.js/publish-cdn-version.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG
28+ ./scripts/angularjs.org/publish.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG
29+ }
30+
31+ function run {
32+ cd ../..
33+ LATEST_VERSION=$( findLatestRelease)
34+
35+ phase prepare
36+ phase publish
37+ }
38+
39+ source $( dirname $0 ) /../utils.inc
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ echo "#################################"
77ARG_DEFS=(
88 " --next-version-type=(patch|minor|major)"
99 " --next-version-name=(.+)"
10+ # require the git dryrun flag so the script can't be run without
11+ # thinking about this!
12+ " --git-push-dryrun=(true|false)"
1013 " [--no-test=(true|false)]"
1114)
1215
Original file line number Diff line number Diff line change @@ -202,7 +202,12 @@ function readJsonProp {
202202# - note: propertyRegex will be automatically placed into a
203203# capturing group! -> all other groups start at index 2!
204204function replaceJsonProp {
205- sed -i . tmp -E 's/"(' $2 ')"[ ]*:[ ]*"' $3 '"/"\1": "' $4 '"/' $1
205+ replaceInFile $1 '"(' $2 ')"[ ]*:[ ]*"' $3 '"' '"\1": "' $4 '"'
206+ }
207+
208+ # replaceInFile(file, findPattern, replacePattern)
209+ function replaceInFile {
210+ sed -i . tmp -E "s/$2/$3/" $1
206211 rm $1 . tmp
207212}
208213
You can’t perform that action at this time.
0 commit comments