-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2024 Ali Sajid Imami | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-License-Identifier: MIT | ||
|
||
ls dist/ | ||
rm -rfv dist/* | ||
set -euo pipefail | ||
set -x | ||
|
||
# Set the necessary variables | ||
|
||
# Set the prefix for the binary | ||
PREFIX="gh-bofh" | ||
|
||
# Declare the associative array mapping Rust triple to Go arch | ||
declare -A GOARCH_MAP=( | ||
["aarch64-apple-darwin"]="darwin-arm64" | ||
["x86_64-apple-darwin"]="darwin-amd64" | ||
["i686-pc-windows-gnu"]="windows-386" | ||
["x86_64-pc-windows-gnu"]="windows-amd64" | ||
["i686-unknown-linux-gnu"]="linux-386" | ||
["x86_64-unknown-linux-gnu"]="linux-amd64" | ||
["aarch64-unknown-linux-gnu"]="linux-arm64" | ||
) | ||
|
||
|
||
TAG=${RELEASE_VERSION:-canary} | ||
# Check the files in the source folder | ||
tree artifacts | ||
|
||
# Check the files in the dist folder | ||
mkdir -p dist | ||
|
||
# Copy binaries with the rust triple and go arch names to the dist folder | ||
for arch in $(basename artifacts/*); do | ||
filename=$PREFIX-$arch | ||
if [ -f "artifacts/$arch/$filename" ]; then | ||
cp -v "artifacts/$arch/$filename" "dist/$filename" | ||
cp -v "artifacts/$arch/$filename" "dist/$PREFIX-${GOARCH_MAP[$arch]}" | ||
fi | ||
done | ||
|
||
# Rename the binaries | ||
cp -vr artifacts/aarch64-apple-darwin/gh-bofh-aarch64-apple-darwin dist/gh-bofh_${TAG}_darwin-arm64 | ||
cp -vr artifacts/aarch64-unknown-linux-gnu/gh-bofh-aarch64-unknown-linux-gnu dist/gh-bofh_${TAG}_linux-arm64 | ||
cp -vr artifacts/i686-unknown-linux-gnu/gh-bofh-i686-unknown-linux-gnu dist/gh-bofh_${TAG}_linux-386 | ||
cp -vr artifacts/x86_64-apple-darwin/gh-bofh-x86_64-apple-darwin dist/gh-bofh_${TAG}_darwin-amd64 | ||
cp -vr artifacts/x86_64-unknown-linux-gnu/gh-bofh-x86_64-unknown-linux-gnu dist/gh-bofh_${TAG}_linux-amd64 | ||
cp -vr artifacts/x86_64-pc-windows-gnu/gh-bofh-x86_64-pc-windows-gnu dist/gh-bofh_${TAG}_windows-amd64.exe | ||
cp -vr artifacts/i686-pc-windows-gnu/gh-bofh-i686-pc-windows-gnu dist/gh-bofh_${TAG}_windows-386.exe | ||
|
||
# Create the checksums | ||
shasum -a 256 dist/* > dist/SHA256SUMS.txt | ||
shasum -a 256 dist/* | sed 's/dist\///' | tee dist/SHA256SUMS.txt | ||
|
||
# Sign the files | ||
for file in dist/*; do | ||
gpg --armor --output "$file.asc" --detach-sig "$file" | ||
done | ||
|
||
tree -a dist/ | ||
|
||
set +x |