Skip to content

Commit 7de25a7

Browse files
bors[bot]Marwes
andauthored
Merge #890
890: feat: Allow the http module to be used without a tcp listener r=Marwes a=Marwes bors r+ Co-authored-by: Markus Westerlind <[email protected]>
2 parents c56510d + 33b00fa commit 7de25a7

File tree

3 files changed

+172
-104
lines changed

3 files changed

+172
-104
lines changed

scripts/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ for PROJECT in "${PROJECTS[@]}"
3333
do
3434
PROJECT_PATH=$(echo "$PROJECT" | sed 's/gluon_//' | sed 's/gluon/./')
3535

36-
if ! (cd "${PROJECT_PATH}" && retry cargo publish "$@"); then
36+
if ! (sync_publish "${PROJECT_PATH}" -f "$@"); then
3737
exit 1
3838
fi
3939
done

scripts/sync_publish.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Usage: sync_publish /path/to/crate -f
4+
#
5+
# Publish a crate and wait for it to become available.
6+
#
7+
# https://gist.github.com/Riateche/a1c500fe760a2b9190beb0a7134db82d
8+
9+
set -e
10+
set -o pipefail
11+
12+
TMP_DIR=/tmp/test1
13+
14+
DIR="$1"
15+
FORCE="$2"
16+
17+
NAME=$(grep '^name' "$DIR/Cargo.toml" | sed 's/name = "\([^"]*\)"/\1/')
18+
cd "$DIR"
19+
20+
VERSION=$(cargo metadata --format-version 1 2>/dev/null | jq -r '.packages[] | select(.name=="'$NAME'").version')
21+
22+
rm -rf "$TMP_DIR"
23+
cargo new "$TMP_DIR" > /dev/null 2>&1
24+
cd "$TMP_DIR"
25+
cargo add "$NAME" --vers "=$VERSION" > /dev/null 2>&1
26+
if cargo generate-lockfile > /dev/null 2>&1; then
27+
echo "$NAME=$VERSION already exists, skipping."
28+
exit 0
29+
fi
30+
31+
echo "Publishing $NAME=$VERSION"
32+
if [ "$FORCE" != "-f" ]; then
33+
echo "This is a dry run. Run with -f to publish."
34+
exit 0
35+
fi
36+
37+
cd "$DIR"
38+
cargo publish
39+
40+
cd "$TMP_DIR"
41+
while ! cargo generate-lockfile > /dev/null 2>&1; do
42+
echo "Waiting for crate to be published..."
43+
sleep 1
44+
done

0 commit comments

Comments
 (0)