Skip to content

Commit

Permalink
refactor: package script more reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
pacostas authored and mhdawson committed Jan 20, 2025
1 parent 071cc74 commit e997ac6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
30 changes: 7 additions & 23 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,31 +144,15 @@ function buildpackage::create() {

util::print::title "Packaging ${buildpack_type}... ${output}"

if [ "$buildpack_type" == "extension" ]; then
cwd=$(pwd)
cd ${BUILD_DIR}
mkdir cnbdir
cd cnbdir
cp ../buildpack.tgz .
tar -xvf buildpack.tgz
rm buildpack.tgz

pack \
extension package "${output}" \
--format file

cd $cwd
else
mkdir ${BUILD_DIR}/cnbdir
tar -xvf ${BUILD_DIR}/buildpack.tgz -C ${BUILD_DIR}/cnbdir
mkdir ${BUILD_DIR}/cnbdir
tar -xvf ${BUILD_DIR}/buildpack.tgz -C ${BUILD_DIR}/cnbdir

pack \
buildpack package "${output}" \
--path ${BUILD_DIR}/cnbdir \
--format file
pack \
"${buildpack_type}" package "${output}" \
--path ${BUILD_DIR}/cnbdir \
--format file

rm -rf ${BUILD_DIR}/cnbdir
fi
rm -rf ${BUILD_DIR}/cnbdir
}

main "${@:-}"
4 changes: 2 additions & 2 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ function main {

function usage() {
cat <<-USAGE
package.sh --version <version> [OPTIONS]
publish.sh --version <version> [OPTIONS]
Packages a buildpack or an extension into a buildpackage .cnb file.
Publishes a buildpack or an extension in to a registry.
OPTIONS
-h, --help Prints the command usage
Expand Down

0 comments on commit e997ac6

Please sign in to comment.