Skip to content

Commit

Permalink
release script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Aug 25, 2024
1 parent 01261e9 commit e32c8cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

(package
(name odiff)
(version 3.1.0)
(version 0.3.1)
(synopsis "CLI for comparing images pixel-by-pixel")
(depends
odiff-core
Expand Down
2 changes: 1 addition & 1 deletion odiff.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "3.1.0"
version: "0.3.1"
synopsis: "CLI for comparing images pixel-by-pixel"
maintainer: ["https://dmtrkovalenko.dev" "[email protected]"]
authors: ["Dmitriy Kovalenko"]
Expand Down
31 changes: 21 additions & 10 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
set -eou pipefail

VERSION="$1"
DRY_RUN=false

for arg in "$@"
do
if [ "$arg" = "--dry-run" ]; then
DRY_RUN=true
break
fi
done

if ! git diff --quiet; then
echo "Error: There are unstaged changes in the repository."
exit 1
Expand All @@ -11,16 +21,17 @@ fi
sed -i '' "s/(version [^)]*)/(version $VERSION)/g" dune-project
dune build

sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" package.json
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" package.json
npm install

sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" npm_package/package.json

git commit -m "chore(release): v$VERSION"

git tag "v$VERSION"

git push origin "v$VERSION"

git push
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" npm_package/package.json

if [ "$DRY_RUN" == true ]; then
echo "Dry run, not committing or tagging"
else
git add --all
git commit -m "chore(release): v$VERSION"
git tag "v$VERSION"
git push origin "v$VERSION"
git push
fi

0 comments on commit e32c8cd

Please sign in to comment.