diff --git a/.changelog_config.yaml b/.changelog_config.yaml new file mode 100644 index 00000000..74c06dc9 --- /dev/null +++ b/.changelog_config.yaml @@ -0,0 +1,11 @@ +--- +owner: recurly +repo: recurly-client-node +tag_matcher: ^4\..* +required_issue_labels: + - V4 +exclude_labels: + - bug? + - internal + - duplicate + - question diff --git a/.github_changelog_generator b/.github_changelog_generator deleted file mode 100644 index 89e0ae4b..00000000 --- a/.github_changelog_generator +++ /dev/null @@ -1,8 +0,0 @@ -user=recurly -project=recurly-client-node -unreleased=false -since-tag=3.0.0-beta.2 -exclude-labels=internal,question,bug?,duplicate -exclude-tags-regex=^[^34]+\..* -issues-wo-labels=false -verbose=false diff --git a/scripts/bump b/scripts/bump deleted file mode 100755 index 8bf226e4..00000000 --- a/scripts/bump +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 - cat .bumpversion.cfg | grep current_version | awk -F" = " '{print $2}' -else - bump2version "$@" -fi diff --git a/scripts/changelog b/scripts/changelog deleted file mode 100755 index f5ae73ff..00000000 --- a/scripts/changelog +++ /dev/null @@ -1,14 +0,0 @@ -#!/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 --future-release "$2" - else - github_changelog_generator -t $GITHUB_TOKEN - fi -fi diff --git a/scripts/prepare-release b/scripts/prepare-release index 7a860f09..5f43a7f1 100755 --- a/scripts/prepare-release +++ b/scripts/prepare-release @@ -1,36 +1,50 @@ #!/usr/bin/env bash -set -e - -# major,minor,patch -PART=${1} -NEXT_VERSION=$(./scripts/bump --next-version $PART) -UNRELEASED_LOG="/tmp/node-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 $NEXT_VERSION\n\n$(cat $UNRELEASED_LOG)" > $UNRELEASED_LOG - # Delete credit line - sed -i '' -e '$ d' $UNRELEASED_LOG - - git checkout -b release-$NEXT_VERSION - # Actually bump the version - ./scripts/bump $PART +# Usage +# +# ./prepare-release major|minor|patch [--notes-out ] [--tag-out ] +# - # Rebuild docs - ./scripts/build +set -e - # Make the commit - git add . --all - git commit -F $UNRELEASED_LOG +if [ -n "$(git status --porcelain)" ]; then + echo "Working directory is not clean. Aborting." + exit 1 +fi - # Push up this branch for PR - git push origin release-$NEXT_VERSION +if [ -z "$GITHUB_TOKEN" ]; then + echo "GITHUB_TOKEN must be set. Aborting." + exit 1 +fi - # Create PR - hub pull-request -c -F $UNRELEASED_LOG +# Bump version +# major|minor|patch +part=${1} +if [ "$part" != "patch" ] && [ "$part" != "minor" ] && [ "$part" != "major" ]; then + echo "'$part' is not a valid option: major|minor|patch" + exit 1 fi +new_version=$(bump2version --list "$part" | grep new_version | cut -d "=" -f 2) + +# Generate Changelog +changelogly --future-release "$new_version" + +while [[ "$#" -gt 0 ]]; do + case $1 in + # Create release notes artifact + -n|--notes-out) + echo "$new_version + + $( + cat CHANGELOG.md | sed -n "/^## \[$new_version\]/,/^##/p" | sed '$d;1d' + )" | awk '{$1=$1};1' > $2 + shift + ;; + + # Create release notes artifact + -t|--tag-out) + echo "v$new_version" > $2 + ;; + esac + shift +done diff --git a/scripts/release b/scripts/release index a65bda74..f6729720 100755 --- a/scripts/release +++ b/scripts/release @@ -1,27 +1,12 @@ #!/usr/bin/env bash -set -e -# TODO this file could be gone -RELEASED_LOG="/tmp/node-pending-changes.md" -THIS_VERSION=$(./scripts/bump --this-version) +set -e -# 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 +# Usage +# +# ./release +# # publish to npm npm publish -# create release -hub release create -c -F $RELEASED_LOG $THIS_VERSION - -# Copy-pasteable messages for announcments -echo ":nodejs: Node.js $THIS_VERSION Released :nodejs:" -echo ":npm: Npm: https://www.npmjs.com/package/recurly/v/$THIS_VERSION" -echo "Release: https://github.com/recurly/recurly-client-node/releases/tag/$THIS_VERSION" -echo "Changelog:" -echo "\`\`\`" -cat "$RELEASED_LOG" -echo "\`\`\`"