-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65fac14
commit 8627024
Showing
2 changed files
with
132 additions
and
116 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 |
---|---|---|
@@ -1,43 +1,35 @@ | ||
#!/usr/bin/env bash | ||
#!/usr/bin/env bash | ||
|
||
SCOPE="$1" | ||
set -o errexit # Exit on most errors (see the manual) | ||
set -o nounset # Disallow expansion of unset variables | ||
set -o pipefail # Use last non-zero exit code in a pipeline | ||
|
||
if [ -z "$SCOPE" ]; then | ||
SCOPE="auto" | ||
fi | ||
|
||
SCOPE="${1:=auto}" | ||
echo "Using scope $SCOPE" | ||
|
||
# We get the next version, without tagging | ||
echo "Getting next version" | ||
nextversion="$(source semtag final -fos $SCOPE)" | ||
nextversion="$(source semtag final -fos "$SCOPE")" | ||
echo "Publishing with version: $nextversion" | ||
|
||
# We replace the placeholder in the source with the new version | ||
replace="s/^PROG_VERSION=\"[^\"]*\"/PROG_VERSION=\"$nextversion\"/g" | ||
sed -i.bak $replace semtag | ||
sed -i.bak "$replace" semtag | ||
|
||
# We replace the version in the README file with the new version | ||
replace="s/^\[Version: [^[]*]/[Version: $nextversion]/g" | ||
sed -i.bak "$replace" README.md | ||
|
||
# We remove the backup README.md generated by the sed command | ||
rm semtag.bak | ||
rm README.md.bak | ||
|
||
# We add both changed files | ||
if ! git add semtag README.md ; then | ||
echo "Error adding modified files with new version" | ||
exit 1 | ||
fi | ||
|
||
if ! git commit -m "Update readme and info to $nextversion" ; then | ||
echo "Error committing modified files with new version" | ||
exit 1 | ||
fi | ||
git add semtag README.md | ||
|
||
if ! git push ; then | ||
echo "Error pushing modified files with new version" | ||
exit 1 | ||
fi | ||
git commit -m "Update readme and info to $nextversion" | ||
git push | ||
|
||
# We update the tag with the new version | ||
source semtag final -f -v $nextversion | ||
source semtag final -f -v "$nextversion" |
Oops, something went wrong.