Skip to content

Commit

Permalink
Build/publish arm64 binaries during release
Browse files Browse the repository at this point in the history
  • Loading branch information
maliksalman authored and robdimsdale committed Apr 20, 2023
1 parent 2cf39e2 commit e122880
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 17 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,45 @@ jobs:
"name": "jam-darwin",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-darwin",
"name": "jam-darwin-amd64",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-darwin-arm64",
"name": "jam-darwin-arm64",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-linux",
"name": "jam-linux",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-linux",
"name": "jam-linux-amd64",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-linux-arm64",
"name": "jam-linux-arm64",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-windows.exe",
"name": "jam-windows.exe",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-windows.exe",
"name": "jam-windows-amd64.exe",
"content_type": "application/octet-stream"
},
{
"path": "build/jam-windows-arm64.exe",
"name": "jam-windows-arm64.exe",
"content_type": "application/octet-stream"
}
]
Expand Down
39 changes: 22 additions & 17 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,28 @@ function build::jam(){

pushd "${ROOT_DIR}" > /dev/null || return
for os in darwin linux windows; do
util::print::info "Building jam on ${os}"

local output
output="${ARTIFACTS_DIR}/jam-${os}"
if [[ "${os}" == "windows" ]]; then
output="${output}.exe"
fi

GOOS="${os}" \
GOARCH="amd64" \
CGO_ENABLED=0 \
go build \
-ldflags "-X github.com/paketo-buildpacks/jam/v2/commands.jamVersion=${version}" \
-o "${output}" \
main.go

chmod +x "${output}"
for arch in amd64 arm64; do
util::print::info "Building jam on ${os} for ${arch}"

local output
output="${ARTIFACTS_DIR}/jam-${os}"
if [[ "${arch}" != "amd64" ]]; then
output="${output}-${arch}"
fi
if [[ "${os}" == "windows" ]]; then
output="${output}.exe"
fi

GOOS="${os}" \
GOARCH="${arch}" \
CGO_ENABLED=0 \
go build \
-ldflags "-X github.com/paketo-buildpacks/jam/v2/commands.jamVersion=${version}" \
-o "${output}" \
main.go

chmod +x "${output}"
done
done
popd > /dev/null || return
}
Expand Down

0 comments on commit e122880

Please sign in to comment.