Skip to content

Commit

Permalink
This is the script I have been using to tag and release prior versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuderman committed Feb 21, 2024
1 parent 3e3d1b5 commit 54d93c8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/tag-and-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

# Date since the last release. We will search for commits newer than this.
# TODO There is probably some Git magic we could do to figure this out
SINCE=${SINCE:-2023-08-19}

# The last version that was tagged.
# TODO There is probably some Git magic we could do to figure this out
LATEST=${LATEST:-5.7.6}

# Search the git log for commits that did an Automatic version bump.
git log --oneline --grep=Automatic --since=$SINCE | awk '{print $1,$NF}' | grep -v $LATEST | tail -r | while read -r line ; do
commit=$(echo $line | awk '{print $1}')
tag=v$(echo $line | awk '{print $2}')
# Get the actual date the commit was made
export GIT_COMMITTER_DATE=$(git show --format=%aD $commit | head -1)
# Tag the commit
echo "Tagging $commit as $tag $GIT_COMMITTER_DATE"
git checkout $commit
git tag -a -m "Automatic tagging of $tag" $tag
git push origin $tag
# Generate the release.
gh release create $tag --generate-notes --latest
done
git checkout master
echo "Done."

0 comments on commit 54d93c8

Please sign in to comment.