-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathReleaseHelpers.sh
executable file
·69 lines (61 loc) · 2.07 KB
/
ReleaseHelpers.sh
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
#!/bin/bash
# arguments: VERSION, BRANCH, BUILD_URL, DIR (optional)
function tag_version {
local VERSION=$1
local BRANCH=$2
local BUILD_URL=$3
local DIR=$4
if [ -z "${DIR}" ]; then
git tag -f -a -m "TASK: Tag as version ${VERSION}" -m "See ${BUILD_URL}" "${VERSION}"
else
git --git-dir "${DIR}/.git" tag -f -a -m "TASK: Tag as version ${VERSION}" -m "See ${BUILD_URL}" "${VERSION}"
fi
}
# arguments: TAG, DIR (optional)
function push_tag {
local TAG=$1
local DIR=$2
if [ -z "${DIR}" ]; then
git push -f origin "${TAG}:refs/tags/${TAG}"
else
git --git-dir "${DIR}/.git" push -f origin "${TAG}:refs/tags/${TAG}"
fi
}
# arguments: BRANCH, BUILD_URL, VERSION, DIR (optional)
function commit_manifest_update {
local BRANCH=$1
local BUILD_URL=$2
local VERSION=$3
local DIR=$4
if [ -z "${DIR}" ]; then
if [[ $(git status --porcelain composer.json "*/composer.json") ]]; then
if [[ $(git status --porcelain composer.json) ]]; then
git add composer.json
fi
if [[ $(git status --porcelain "*/composer.json") ]]; then
git add ./*/composer.json
fi
git commit -m "TASK: Update composer manifest for ${VERSION}" -m "See ${BUILD_URL}"
fi
else
if [[ $(git --git-dir "${DIR}/.git" --work-tree "${DIR}" status --porcelain composer.json "*/composer.json") ]]; then
if [[ $(git --git-dir "${DIR}/.git" --work-tree "${DIR}" status --porcelain composer.json) ]]; then
git --git-dir "${DIR}/.git" --work-tree "${DIR}" add composer.json
fi
if [[ $(git --git-dir "${DIR}/.git" --work-tree "${DIR}" status --porcelain "*/composer.json") ]]; then
git --git-dir "${DIR}/.git" --work-tree "${DIR}" add "*/composer.json"
fi
git --git-dir "${DIR}/.git" --work-tree "${DIR}" commit -m "TASK: Update composer manifest for ${VERSION}" -m "See ${BUILD_URL}"
fi
fi
}
# arguments: BRANCH, DIR (optional)
function push_branch {
local BRANCH=$1
local DIR=$2
if [ -z "${DIR}" ]; then
git push origin "${BRANCH}"
else
git --git-dir "${DIR}/.git" push origin "${BRANCH}"
fi
}