Skip to content

Commit

Permalink
Merge pull request #26 from recurly/scripts-and-bump-3-0-0
Browse files Browse the repository at this point in the history
Add some more scripts and bump to 3.0.0
  • Loading branch information
joannasese authored May 18, 2020
2 parents 469caef + dc1dde1 commit 9e67f8d
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bumpversion]
current_version = 3.0.0
parse = (?P<major>\d+)
\.(?P<minor>\d+)
\.(?P<patch>\d+)
serialize =
{major}.{minor}.{patch}

[bumpversion:file:version.go]

8 changes: 8 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
user=recurly
project=recurly-client-go
unreleased=false
exclude-labels=question,bug?,duplicate
exclude-tags-regex=^[^3]+\..*
issues-wo-labels=false
verbose=false
since-tag=3.0.0-beta.1
11 changes: 11 additions & 0 deletions scripts/bump
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e

if [ "$1" == "--next-version" ]; then
shift
bump2version --dry-run --list "$@" | grep new_version | cut -d "=" -f 2
elif [ "$1" == "--this-version" ]; then
grep current_version .bumpversion.cfg | awk -F" = " '{print $2}'
else
bump2version "$@"
fi
14 changes: 14 additions & 0 deletions scripts/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e

if [ -z "$GITHUB_TOKEN" ]; then
echo "Environment variable GITHUB_TOKEN must be set"
else
if [ "$1" == "--pending" ]; then
github_changelog_generator -t $GITHUB_TOKEN --unreleased-only -o "$2"
elif [ "$1" == "--release-tag" ]; then
github_changelog_generator -t $GITHUB_TOKEN --unreleased true --unreleased-label "$2"
else
github_changelog_generator -t $GITHUB_TOKEN
fi
fi
36 changes: 36 additions & 0 deletions scripts/prepare-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e

# major,minor,patch
PART=${1}
NEXT_VERSION=$(./scripts/bump --next-version "$PART")
UNRELEASED_LOG="/tmp/go-pending-changes.md"

if [ -z "$NEXT_VERSION" ]; then
echo "Failed to get next version"
else
# Generate pending changes in tmpfile
./scripts/changelog --pending $UNRELEASED_LOG
# Add a git message header of Release X.Y.Z
printf "Release %s\n\n$(cat $UNRELEASED_LOG)" "$NEXT_VERSION" > $UNRELEASED_LOG
# Delete credit line
sed -i '' -e '$ d' $UNRELEASED_LOG

git checkout -b "release-$NEXT_VERSION"

# Actually bump the version
./scripts/bump "$PART"

# Rebuild docs
./scripts/build

# Make the commit
git add . --all
git commit -F "$UNRELEASED_LOG"

# Push up this branch for PR
git push origin "release-$NEXT_VERSION"

# Create PR
hub pull-request -c -F "$UNRELEASED_LOG"
fi
23 changes: 23 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e

# TODO this file could be gone
RELEASED_LOG="/tmp/go-pending-changes.md"
THIS_VERSION=$(./scripts/bump --this-version)

# Generate the changelog with changes in this release
./scripts/changelog --release-tag "$THIS_VERSION"
git add CHANGELOG.md
git commit -m "Update Changelog for Release $THIS_VERSION"
git push origin master

# create release
hub release create -c -F "$RELEASED_LOG" "$THIS_VERSION"

# Copy-pasteable messages for announcments
echo ":partygopher: Go $THIS_VERSION Released :partygopher:"
echo "Release: https://github.com/recurly/recurly-client-go/releases/tag/$THIS_VERSION"
echo "Changelog:"
echo "\`\`\`"
cat "$RELEASED_LOG"
echo "\`\`\`"
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package recurly

const (
clientVersion = "3.0.0-beta.1"
clientVersion = "3.0.0"
)

0 comments on commit 9e67f8d

Please sign in to comment.