Skip to content

Commit

Permalink
Hardcode version, add a release script
Browse files Browse the repository at this point in the history
Having thought about this more, I am semi-reverting
fcd4d58 in favor of hardcoding the
version to the binary and a release script.
  • Loading branch information
motiejus committed May 10, 2024
1 parent fcd4d58 commit 5643464
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FILES = btrfs-auto-snapshot
FILES = btrfs-auto-snapshot release

.PHONY: lint
lint: shfmt shellcheck
Expand Down
4 changes: 1 addition & 3 deletions btrfs-auto-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ set -euo pipefail
#set -o functrace
#set -o xtrace

# Define our version. Distributions may replace it with:
# sed -i 's/^\(BTRFS_AUTO_SNAPSHOT_VERSION\)=.*/\1=<version>/' <file>
BTRFS_AUTO_SNAPSHOT_VERSION=${BTRFS_AUTO_SNAPSHOT_VERSION:-unknown}
BTRFS_AUTO_SNAPSHOT_VERSION=v2.0.4+dev

# Define various error codes
ERR_SUCCESS=0
Expand Down
30 changes: 30 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail

log_run()
{
echo >&2 "+ $*"
"$@"
}

main()
{
VERSION=$1
if [[ ! $VERSION =~ ^v[0-9]\.[0-9]\.[0-9]$ ]]; then
echo >&2 "Invalid version. Expected v1.2.3 or so"
exit 1
fi

log_run sed -i'' 's/^\(BTRFS_AUTO_SNAPSHOT_VERSION\)=.*/\1='"$VERSION/" btrfs-auto-snapshot
log_run git add btrfs-auto-snapshot
log_run git commit -m "Release $VERSION"
log_run git tag "$VERSION"
log_run sed -i'' 's/^\(BTRFS_AUTO_SNAPSHOT_VERSION\)=.*/\1='"$VERSION+dev/" btrfs-auto-snapshot
log_run git add btrfs-auto-snapshot
log_run git commit -m "$VERSION+dev"
echo "You have tagged $VERSION. Now run the following:"
echo " git push origin master"
echo " git push origin $VERSION"
}

main "$@"

0 comments on commit 5643464

Please sign in to comment.