Skip to content

Commit 8b13466

Browse files
committed
Prettify GitHub release artifact names (pt 2)
1 parent d5c38c3 commit 8b13466

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ FreeBSD builds are tested in [Cirrus CI](https://cirrus-ci.org/) and cross-compi
166166
VERSION=v0.2.0
167167
RELEASE_URL=https://github.com/IvanIsCoding/celq/releases/download/${VERSION}
168168
169-
fetch ${RELEASE_URL}/celq-x86_64-unknown-freebsd.tar.gz
169+
fetch ${RELEASE_URL}/celq-freebsd-x86_64.tar.gz
170170
171-
tar xzf celq-x86_64-unknown-freebsd.tar.gz
171+
tar xzf celq-freebsd-x86_64.tar.gz
172172
su root -c 'install -m 755 celq /usr/local/bin/'
173173
```
174174

docs/installation_guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ FreeBSD builds are tested in [Cirrus CI](https://cirrus-ci.org/) and cross-compi
178178
VERSION=v0.2.0
179179
RELEASE_URL=https://github.com/IvanIsCoding/celq/releases/download/${VERSION}
180180
181-
fetch ${RELEASE_URL}/celq-x86_64-unknown-freebsd.tar.gz
181+
fetch ${RELEASE_URL}/celq-freebsd-x86_64.tar.gz
182182
183-
tar xzf celq-x86_64-unknown-freebsd.tar.gz
183+
tar xzf celq-freebsd-x86_64.tar.gz
184184
su root -c 'install -m 755 celq /usr/local/bin/'
185185
```
186186

template_install.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ FLAGS:
2929
3030
OPTIONS:
3131
--to LOCATION Where to install the binary [default: $CARGO_HOME/bin, $HOME/.cargo/bin, $HOME/.local/bin or $HOME/bin]
32-
--target TARGET
32+
--target TARGET Following Rust target triple conventions (e.g. x86_64-unknown-linux-gnu).
3333
--verify-attestation Verify the binary's GitHub Actions attestation (requires GitHub CLI with authentication)
3434
EOF
3535
}
@@ -87,6 +87,24 @@ check_attestation() {
8787
return 0
8888
}
8989

90+
# Map Rust target triple to pretty download name
91+
target_to_pretty_name() {
92+
local rust_target="$1"
93+
94+
case "$rust_target" in
95+
aarch64-apple-darwin) echo "macos-aarch64";;
96+
x86_64-apple-darwin) echo "macos-x86_64";;
97+
x86_64-pc-windows-msvc) echo "windows-x86_64";;
98+
x86_64-unknown-linux-musl) echo "linux-x86_64-musl";;
99+
aarch64-unknown-linux-musl) echo "linux-aarch64-musl";;
100+
x86_64-unknown-linux-gnu) echo "linux-x86_64-gnu";;
101+
aarch64-unknown-linux-gnu) echo "linux-aarch64-gnu";;
102+
*)
103+
err "Unsupported target: $rust_target"
104+
;;
105+
esac
106+
}
107+
90108
force=false
91109
verify_attestation=false
92110
while test $# -gt 0; do
@@ -173,12 +191,15 @@ if [ -z "${target-}" ]; then
173191
esac
174192
fi
175193

194+
# Convert target to pretty name for download URL
195+
pretty_target=$(target_to_pretty_name "$target")
196+
176197
case $target in
177198
x86_64-pc-windows-msvc) extension=zip; need unzip;;
178199
*) extension=tar.gz; need tar;;
179200
esac
180201

181-
archive="$releases/download/{{CELQ_VERSION}}/$crate-$target.$extension"
202+
archive="$releases/download/{{CELQ_VERSION}}/$crate-$pretty_target.$extension"
182203

183204
say "Repository: $url"
184205
say "Crate: $crate"

0 commit comments

Comments
 (0)