aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/jenkins/release.sh
blob: bb512f7030bb4eb580e83d656fc4b913b3ed127e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash

# tags the current commit as a release and publishes all artifacts to
# the different repositories.
# Note: This will also works if the commit is in the past!

echo "#################################"
echo "#### cut release     ############"
echo "#################################"

ARG_DEFS=(
  # require the git dryrun flag so the script can't be run without
  # thinking about this!
  "--git-push-dryrun=(true|false)"
  # The sha to release. Needs to be the same as HEAD.
  # given as parameter to double check.
  "--commit-sha=(.*)"
  # the version number of the release.
  # e.g. 1.2.12 or 1.2.12-rc.1
  "--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
  # the codename of the release
  "--version-name=(.+)"
)

function init {
  if [[ $(git rev-parse HEAD) != $(git rev-parse $COMMIT_SHA) ]]; then
    echo "HEAD is not at $COMMIT_SHA"
    usage
  fi

  if [[ ! $VERBOSE ]]; then
    VERBOSE=false
  fi
  VERBOSE_ARG="--verbose=$VERBOSE"
}

function build {
  cd ../..

  npm install --color false
  grunt ci-checks package --no-color

  cd $SCRIPT_DIR
}

function phase {
  ACTION_ARG="--action=$1"
  ../angular.js/tag-release.sh $ACTION_ARG $VERBOSE_ARG\
    --version-number=$VERSION_NUMBER --version-name=$VERSION_NAME\
    --commit-sha=$COMMIT_SHA

  if [[ $1 == "prepare" ]]; then
    # The build requires the tag to be set already!
    build
  fi

  ../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG
  ../bower/publish.sh $ACTION_ARG $VERBOSE_ARG
  ../angular-seed/publish.sh $ACTION_ARG $VERBOSE_ARG --no-test=true
  ../angular-phonecat/publish.sh $ACTION_ARG $VERBOSE_ARG --no-test=true
}

function run {
  # First prepare all scripts (build, test, commit, tag, ...),
  # so we are sure everything is all right
  phase prepare
  # only then publish to github
  phase publish
}

source $(dirname $0)/../utils.inc