Skip to content

Commit

Permalink
Enhance drafting and publishing release
Browse files Browse the repository at this point in the history
* Add check for existing released tags for draft a new release. -> Prevent drafting already published release again.
* Add leniency to publishing a release crate. -> Try 3 times while waiting exponential time between retries.
  • Loading branch information
juhaku committed Feb 14, 2022
1 parent 4b27daf commit 37e7d96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ jobs:
echo "::set-output name=is_prerelease::$prerelease"
echo "::set-output name=version::$version"
- name: Check existing release
run: |
if git tag | grep ${{ steps.release_info.outputs.version }} > /dev/null; then
echo "Tag tag with ${{ steps.release_info.outputs.version }} already exists, cannot draft a release for already existing tag!, Consider upgrading versions to Cargo.toml file" && exit 1
fi
- name: Remove previous release
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@ jobs:
for manifest in $(echo "$manifests" | xargs); do
module=$(cargo read-manifest --manifest-path "$manifest" | jq -r .name)
if [[ "$module" == "utoipa" ]]; then
cargo publish
retry=0
while ! cargo publish && [[ $retry -lt 3 ]]; do
echo "Failed to publish, Retrying... $retry after $((retry*1)) sec."
sleep $((retry*1))
retry=$((retry+1))
done
if [[ $retry -eq 3 ]]; then
echo "Failed to publish crate utoipa, try to increase wait? Or retries?" && exit 1
fi
else
cargo publish -p "$module"
retry=0
while ! cargo publish -p "$module" && [[ $retry -lt 3 ]]; do
echo "Failed to publish, Retrying... $retry after $((retry*1)) sec."
sleep $((retry*1))
retry=$((retry+1))
done
if [[ $retry -eq 3 ]]; then
echo "Failed to publish crate $module, try to increase wait? Or retries?" && exit 1
fi
fi
done

0 comments on commit 37e7d96

Please sign in to comment.