Skip to content

Commit ceb51b1

Browse files
committed
Update scripts to work with shared CI.
1 parent 8d19872 commit ceb51b1

1 file changed

Lines changed: 31 additions & 6 deletions

File tree

scripts/package.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ readonly ROOTDIR
1414
source "${ROOTDIR}/scripts/.util/print.sh"
1515

1616
function main() {
17-
local stack cached
17+
local stack cached version
1818
stack="any"
1919
cached="false"
20+
version=""
21+
output="${ROOTDIR}/build/buildpack.zip"
2022

2123
while [[ "${#}" != 0 ]]; do
2224
case "${1}" in
@@ -25,6 +27,11 @@ function main() {
2527
shift 2
2628
;;
2729

30+
--version)
31+
version="${2}"
32+
shift 2
33+
;;
34+
2835
--cached)
2936
cached="true"
3037
shift 1
@@ -35,6 +42,11 @@ function main() {
3542
shift 1
3643
;;
3744

45+
--output)
46+
output="${2}"
47+
shift 2
48+
;;
49+
3850
--help|-h)
3951
shift 1
4052
usage
@@ -51,7 +63,7 @@ function main() {
5163
esac
5264
done
5365

54-
package::buildpack "${cached}" "${stack}"
66+
package::buildpack "${version}" "${cached}" "${stack}" "${output}"
5567
}
5668

5769

@@ -64,14 +76,21 @@ OPTIONS
6476
--cached packages the buildpack as a cached buildpack
6577
--uncached packages the buildpack as an uncached buildpack (default)
6678
--stack the stack to package the buildpack for (default: any)
79+
--version <version> -v <version> specifies the version number to use when packaging the buildpack
6780
USAGE
6881
}
6982

7083
function package::buildpack() {
71-
local cached stack
72-
cached="${1}"
73-
stack="${2}"
74-
84+
local version cached stack output
85+
version="${1}"
86+
cached="${2}"
87+
stack="${3}"
88+
output="${4}"
89+
90+
if [[ -n "${version}" ]]; then
91+
echo "writing version to VERSION file: ${version}"
92+
echo "${version}" > "${ROOTDIR}/VERSION"
93+
fi
7594

7695
local stack_flag
7796
stack_flag="--any-stack"
@@ -102,6 +121,12 @@ EOF
102121
popd &> /dev/null
103122

104123
rm -f "${ROOTDIR}/Dockerfile"
124+
125+
file="$(ls "${ROOTDIR}" | grep -i 'php.*zip' )"
126+
if [[ -z "${file}" ]]; then
127+
util::print::error "failed to find zip file in ${ROOTDIR}"
128+
fi
129+
mv "${file}" "${output}"
105130
}
106131

107132
main "${@:-}"

0 commit comments

Comments
 (0)