Skip to content

Commit

Permalink
Fix ci/publish.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 5, 2021
1 parent eaebdd6 commit 630766d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: taiki-e/github-actions/install-rust@main
- run: taiki-e/github-actions/install-rust@main
with:
toolchain: stable
- run: |
ci/publish.sh
env:
Expand Down
40 changes: 7 additions & 33 deletions ci/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,13 @@
set -euo pipefail
IFS=$'\n\t'

# A list of paths to the crate to be published.
# It will be published in the order listed.
MEMBERS=(
"pin-project-internal"
"."
)

function error {
echo "error: $*" >&2
}
cd "$(cd "$(dirname "${0}")" && pwd)"/..

function retry() {
local -i max_retry=${1}
local -i count=0
while ! eval "${2}"; do
((count++))
if ((count > max_retry)); then
error "${3}"
exit 1
fi
echo "info: retry after $((10 * count)) seconds"
sleep $((10 * count))
done
}
set -x

cd "$(cd "$(dirname "${0}")" && pwd)"/..
cd pin-project-internal
cargo publish
cd ..

# publishing
for member in "${MEMBERS[@]}"; do
(
cd "${member}"
pwd
echo "info: running 'cargo publish ${dryrun:-}'"
retry 2 "cargo publish ${dryrun:-}" "unable to publish ${member}"
)
done
sleep 30
cargo publish

0 comments on commit 630766d

Please sign in to comment.