Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Automate Billwerk Gem Deployment and Changelog generation #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ Gemfile.lock

.tags
.tags1

/node_modules
yarn-error.log
yarn-debug.log*
.yarn-integrity
27 changes: 27 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Added"
}, {
"type": "fix",
"section": "Fixed"
}, {
"type": "change",
"section": "Changed"
}, {
"type": "deprecate",
"section": "Deprecated"
}, {
"type": "remove",
"section": "Removed"
}, {
"type": "security",
"section": "Security"
}
]
}
93 changes: 93 additions & 0 deletions CHANGELOG.back.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
## [UNRELEASED]
### Added
- get contract_changes

### Changed
- Set required ruby version to >= 2.6
- Replace Travis CI with CircleCI
- `rubocop` version is specified to be `~> 1.8.1`
- `performance` version is specified to be `~> 1.7.0`

### Deprecated

### Removed
- Drop support for Ruby <= 2.5
- Drop support for JRuby

### Fixed

### Security

## [0.6.0] - 2021-03-03
### Changed
- `faraday_middleware` version is specified to be `>= 1.0.0`

## [0.5.0] - 2019-06-11
### Changed
- Updates gem dependencies to latest versions (#65):
- replaces rash with rash_alt
- removes specific faraday_middleware version dependency

## [0.4.0] - 2019-04-30
### Added
* download Invoices as PDF (#60)

### Changed
* new prodcution endpoint (#45)

## [0.3.0] - 2017-09-04
### Added
- get a self service token for a given contract
- get a specific customer by id
- get and delete rated items
- get a specific payment transaction by id
- call to terminate a contract

### Changed
- update version of jruby to 9.1.5.0

### Deprecated

### Removed
- support for ruby version 1.8.x and 1.9.x
- support for rubinius

### Fixed
- issue where stubbing the PactasItero.client method caused
a "Stack level too deep" error on rspec > 3.3

### Security

## [0.2.0] - 2016-02-04
### Added
- a changelog
- get operation for orders
- create_customer method

### Changed
- create orders without a contract_id
- changes sandbox url from sandbox.pactas.com to sandbox.billwerk.com

-----------------------------------------------------------------------------------------

Template:
## [0.0.0] - 2014-05-31
### Added
- something was added

### Changed
- something changed

### Deprecated
- something is deprecated

### Removed
- something was removed

### Fixed
- something was fixed

### Security
- a security fix

Following "[Keep a CHANGELOG](http://keepachangelog.com/)"
102 changes: 39 additions & 63 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,69 @@
## [UNRELEASED]
### Added
- get contract_changes

### Changed
- Set required ruby version to >= 2.6
- Replace Travis CI with CircleCI
- `rubocop` version is specified to be `~> 1.8.1`
- `performance` version is specified to be `~> 1.7.0`
# Changelog

### Deprecated
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### Removed
- Drop support for Ruby <= 2.5
- Drop support for JRuby

### Fixed
### [0.6.1](https://github.com/shipcloud/billwerk/compare/v0.6.0...v0.6.1) (2022-02-18)

### Security
### Added

## [0.6.0] - 2021-03-03
### Changed
- `faraday_middleware` version is specified to be `>= 1.0.0`
* **contract-changes:** add contract changes endpoint ([#107](https://github.com/shipcloud/billwerk/issues/107)) ([9d440a6](https://github.com/shipcloud/billwerk/commit/9d440a6e1050bb12168bc3d19f566a3abebdbbbc))

## [0.5.0] - 2019-06-11
### Changed
- Updates gem dependencies to latest versions (#65):
- replaces rash with rash_alt
- removes specific faraday_middleware version dependency

## [0.4.0] - 2019-04-30
### Added
* download Invoices as PDF (#60)
* Set required ruby version to >= 2.6
* Replace Travis CI with CircleCI
* `rubocop` version is specified to be `~> 1.8.1`
* `performance` version is specified to be `~> 1.7.0`

### Changed
* new prodcution endpoint (#45)

## [0.3.0] - 2017-09-04
### Added
- get a self service token for a given contract
- get a specific customer by id
- get and delete rated items
- get a specific payment transaction by id
- call to terminate a contract
### [0.6.0] - 2021-03-03

### Changed
- update version of jruby to 9.1.5.0
* `faraday_middleware` version is specified to be `>= 1.0.0`

### Deprecated

### Removed
- support for ruby version 1.8.x and 1.9.x
- support for rubinius
### [0.5.0] - 2019-06-11

### Fixed
- issue where stubbing the PactasItero.client method caused
a "Stack level too deep" error on rspec > 3.3
### Changed
* Updates gem dependencies to latest versions (#65):
* replaces rash with rash_alt
* removes specific faraday_middleware version dependency

### Security
### [0.4.0] - 2019-04-30

## [0.2.0] - 2016-02-04
### Added
- a changelog
- get operation for orders
- create_customer method
* download Invoices as PDF (#60)

### Changed
- create orders without a contract_id
- changes sandbox url from sandbox.pactas.com to sandbox.billwerk.com
* new prodcution endpoint (#45)

-----------------------------------------------------------------------------------------

Template:
## [0.0.0] - 2014-05-31
### [0.3.0] - 2017-09-04
### Added
- something was added
* get a self service token for a given contract
* get a specific customer by id
* get and delete rated items
* get a specific payment transaction by id
* call to terminate a contract

### Changed
- something changed

### Deprecated
- something is deprecated
* update version of jruby to 9.1.5.0

### Removed
- something was removed
* support for ruby version 1.8.x and 1.9.x
* support for rubinius

### Fixed
- something was fixed
* issue where stubbing the PactasItero.client method caused
a "Stack level too deep" error on rspec > 3.3

### Security
- a security fix

Following "[Keep a CHANGELOG](http://keepachangelog.com/)"
### [0.2.0] - 2016-02-04
### Added
* a changelog
* get operation for orders
* create_customer method

### Changed
* create orders without a contract_id
* changes sandbox url from sandbox.pactas.com to sandbox.billwerk.com
2 changes: 1 addition & 1 deletion lib/pactas_itero/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PactasItero
VERSION = "0.6.0".freeze
VERSION = "0.6.1".freeze
end
110 changes: 110 additions & 0 deletions lib/tasks/release.thor
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# frozen_string_literal: true

require "thor"
require "json"
require "git"

class Release < Thor
include Thor::Actions

BASE_BRANCH = "chore/deployment"

def self.exit_on_failure?
true
end

desc "new", "Create new Version"
option :push, type: :boolean, default: false, aliases: :p
def new(major = nil)
check_for_base_branch

check_for_changes

if major.nil?
run("yarn run standard-version")
else
run("yarn run standard-version --release-as major")
end

bump_version

run("thor release:push") if options[:push]
end

desc "push", "Push new Version"
def push
puts "Pushing new Version"

run("git push origin #{BASE_BRANCH} --tags --no-verify")
run("git push origin #{BASE_BRANCH} --no-verify", capture: true) # push your changes to update your local state
end

no_commands do
private def check_for_base_branch
if git.current_branch != BASE_BRANCH
raise Thor::Error, "Please switch to the base branch #{BASE_BRANCH}"
end
end

private def check_for_changes
no_changes = (%i[deleted added changed untracked].all? do |status|
git.status.send(status).nil? || git.status.send(status).empty?
end)

return if no_changes

raise Thor::Error,
"There are unstaged changes! Please commit or remove them before continuing"
end

private def git
@_git ||= Git.open("#{__dir__}/../..")
end

private def versions
load version_file
package_data = JSON.parse(File.read(package_file))

current_version = PactasItero::VERSION
next_version = package_data["version"]

[current_version, next_version]
end

private def update_version_file
current_version, next_version = versions

content = File.read(version_file)
File.open(version_file, "w") do |file|
new_content = content.gsub(current_version, next_version)
file.write(new_content)
end

next_version
end

private def version_file
"lib/pactas_itero/version.rb"
end

private def changelog_file
"CHANGELOG.md"
end

private def package_file
"package.json"
end

private def bump_version
puts "Create new Version"

next_version = update_version_file

run("git add #{version_file}")
run("git add #{changelog_file}")
run("git add #{package_file}")
run("git commit -m 'release: new Version #{next_version}' --no-verify")
run("git tag #{next_version} -m 'Release #{next_version}'")
end
end
end
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "billwerk",
"version": "0.6.1",
"description": "Billwerk provides a client mapping for accessing the Pactas Itero API, making it easy to post your data to, and read your data from your Pactas account.",
"main": "index.js",
"repository": "https://github.com/shipcloud/billwerk.git",
"author": "Marten Klitzke <[email protected]>",
"license": "MIT",
"private": true,
"devDependencies": {
"standard-version": "^9.3.2"
}
}
Loading