Skip to content

Commit

Permalink
Shellcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbowes committed Dec 5, 2024
1 parent 65fac14 commit 8627024
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 116 deletions.
34 changes: 13 additions & 21 deletions release.sh
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"
Loading

0 comments on commit 8627024

Please sign in to comment.