File tree Expand file tree Collapse file tree 3 files changed +172
-104
lines changed
Expand file tree Collapse file tree 3 files changed +172
-104
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ for PROJECT in "${PROJECTS[@]}"
3333do
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
3939done
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments