-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
if the travis build passed, we want to create a git tag regardless of whether or not a crate was published then publish the crate only if the git tag didn't previously exist
- Loading branch information
Showing
1 changed file
with
14 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,27 @@ set -o errexit -o nounset | |
|
||
([[ $TRAVIS_BRANCH != "master" ]] || [[ $TRAVIS_PULL_REQUEST != "false" ]]) && exit 0 | ||
|
||
cargo login $CRATESIO_TOKEN | ||
version=$(cat Cargo.toml | awk -F'"' '/version/{print $2}') | ||
|
||
if cargo publish; then | ||
echo "Published new version on crates.io" | ||
|
||
echo "Creating new git tag" | ||
version=$(cat Cargo.toml | awk -F'"' '/version/{print $2}') | ||
if ! git rev-parse $version > /dev/null 2>&1; then | ||
echo "Creating new git tag $version" | ||
|
||
git config user.name "Jorge Israel Peña" | ||
git config user.email "[email protected]" | ||
|
||
git remote add upstream "https://$GH_TOKEN@github.com/blaenk/hoedown.git" | ||
git tag -a "v$version" -m "published https://crates.io/crates/hoedown/$version" | ||
git push upstream --tags | ||
|
||
echo "Publishing to crates.io" | ||
|
||
cargo login $CRATESIO_TOKEN | ||
|
||
if cargo publish; then | ||
echo "Published new version on crates.io" | ||
else | ||
echo "Error; Perhaps version already exists?" | ||
fi | ||
else | ||
echo "Version already existed" | ||
echo "Tag $version already exists; no tag created, no crate published" | ||
fi | ||
|