Build and store multiple types for binary

This commit is contained in:
Chris Roberts 2022-08-03 10:15:01 -07:00
parent db31578438
commit d2e95ad3b5
2 changed files with 86 additions and 18 deletions

View File

@ -23,18 +23,53 @@ wrap aws s3 cp "${gem}" "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-main.gem
# Install submodules
wrap git submodule update --init --recursive \
"Failed to install git submodules"
# Build our binary
wrap make \
"Failed to build the Vagrant go binary"
# Build our binaries
# Build linux amd64 binary
wrap make bin/linux \
"Failed to build the Vagrant go linux amd64 binary"
# Rename our binary
wrap mv vagrant vagrant-go \
"Failed to rename vagrant binary"
wrap mv vagrant vagrant-go_linux_amd64 \
"Failed to rename vagrant linux amd64 binary"
# Zip the binary
wrap zip vagrant-go vagrant-go \
"Failed to compress go binary"
wrap zip vagrant-go_linux_amd64 vagrant-go_linux_amd64 \
"Failed to compress go linux amd64 binary"
# Store the binary asset
wrap aws s3 cp vagrant-go.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go-main.zip" \
"Failed to store Vagrant Go main build"
wrap aws s3 cp vagrant-go_linux_amd64.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_linux_amd64.zip" \
"Failed to store Vagrant Go linux amd64 main build"
# Build linux 386 binary
wrap make bin/linux-386 \
"Failed to build the Vagrant go linux 386 binary"
# Rename our binary
wrap mv vagrant vagrant-go_linux_386 \
"Failed to rename vagrant linux 386 binary"
# Zip the binary
wrap zip vagrant-go_linux_386 vagrant-go_linux_386 \
"Failed to compress go linux 386 binary"
# Store the binary asset
wrap aws s3 cp vagrant-go_linux_386.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_linux_386.zip" \
"Failed to store Vagrant Go linux 386 main build"
# Build darwin binary
wrap make bin/darwin \
"Failed to build the Vagrant go darwin amd64 binary"
# Rename our binary
wrap mv vagrant vagrant-go_darwin_amd64 \
"Failed to rename vagrant darwin amd64 binary"
# Zip the binary
wrap zip vagrant-go_darwin_amd64 vagrant-go_darwin_amd64 \
"Failed to compress go darwin amd64 binary"
# Store the binary asset
wrap aws s3 cp vagrant-go_darwin_amd64.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_darwin_amd64.zip" \
"Failed to store Vagrant Go darwin amd64 main build"

View File

@ -35,22 +35,55 @@ gem=$(printf "%s" "${g}")
vagrant_version="$(gem specification "${gem}" version)"
vagrant_version="${vagrant_version##*version: }"
# Build the go binary
wrap make \
"Failed to build the Vagrant go binary"
# Install submodules
wrap git submodule update --init --recursive \
"Failed to install git submodules"
wrap mv vagrant vagrant-go \
"Failed to rename Vagrant go binary"
wrap zip vagrant-go vagrant-go \
"Failed to compress go binary"
# Build our binaries
# Build linux amd64 binary
wrap make bin/linux \
"Failed to build the Vagrant go linux amd64 binary"
# Rename our binary
wrap mv vagrant vagrant-go_linux_amd64 \
"Failed to rename vagrant linux amd64 binary"
# Zip the binary
wrap zip "vagrant-go_${vagrant_version}_linux_amd64" vagrant-go_linux_amd64 \
"Failed to compress go linux amd64 binary"
# Build linux 386 binary
wrap make bin/linux-386 \
"Failed to build the Vagrant go linux 386 binary"
# Rename our binary
wrap mv vagrant vagrant-go_linux_386 \
"Failed to rename vagrant linux 386 binary"
# Zip the binary
wrap zip "vagrant-go_${vagrant_version}_linux_386" vagrant-go_linux_386 \
"Failed to compress go linux 386 binary"
# Build darwin binary
wrap make bin/darwin \
"Failed to build the Vagrant go darwin amd64 binary"
# Rename our binary
wrap mv vagrant vagrant-go_darwin_amd64 \
"Failed to rename vagrant darwin amd64 binary"
# Zip the binary
wrap zip "vagrant-go_${vagrant_version}_darwin_amd64" vagrant-go_darwin_amd64 \
"Failed to compress go darwin amd64 binary"
wrap mkdir release-assets \
"Failed to create release assets directory"
wrap mv vagrant*.gem release-assets \
"Failed to move Vagrant RubyGem asset to release asset directory"
wrap mv vagrant-go.zip release-assets \
"Failed to move Vagrant go asset to release asset directory"
wrap mv vagrant-go*.zip release-assets \
"Failed to move Vagrant go assets to release asset directory"
# We want to release into the builders repository so
# update the repository variable with the desired destination