Skip to content

Commit 12c121a

Browse files
authored
chore: Add semantic-release (#15)
* Add semantic-release * Try a release stage * Try CI again * Try again * Try again * Rename stages * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Add semantic-release config * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try again * Try without dry-run * Format old CHANGELOG entries * Add changelog plugin * Update lock file during prepare step * Switch back to dry-run for now * Delete built gem after publish * Add git plugin * Revert release * Re-enabled tests * Enforce semantic-release PR titles * Only enable on master branch * Enable everything * Turn off dry-run mode * Fix spelling * Only run the release stage on master * Only release during push builds
1 parent 335505b commit 12c121a

File tree

8 files changed

+2765
-86
lines changed

8 files changed

+2765
-86
lines changed

.github/semantic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enforce PR titles follow semantic-release format
2+
titleOnly: true

.travis.yml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
1-
matrix:
1+
jobs:
22
include:
3-
- name: 'rspec Tests'
4-
language: ruby
5-
rvm:
6-
- 2.3
7-
cache: bundler
8-
before_install:
9-
- gem update --system
10-
- gem install bundler
11-
script:
12-
- bundle exec rake
13-
- bundle exec rake rubocop
14-
- name: "Integration Tests"
15-
language: node_js
16-
node_js: node
17-
cache: yarn
18-
before_install:
19-
- rvm use 2.3 --install --binary --fuzzy
20-
- ruby --version
21-
- gem update --system
22-
- gem install bundler
23-
- bundle install --jobs=3 --retry=3 --deployment
24-
script:
25-
- yarn test
26-
- yarn lint
3+
- stage: 'Test'
4+
name: 'rspec Tests'
5+
language: ruby
6+
rvm:
7+
- 2.3
8+
cache: bundler
9+
before_install:
10+
- gem update --system
11+
- gem install bundler
12+
script:
13+
- bundle exec rake
14+
- bundle exec rake rubocop
15+
- name: "Integration Tests"
16+
language: node_js
17+
node_js: node
18+
cache: yarn
19+
before_install:
20+
- rvm use 2.3 --install --binary --fuzzy
21+
- ruby --version
22+
- gem update --system
23+
- gem install bundler
24+
- bundle install --jobs=3 --retry=3 --deployment
25+
script:
26+
- yarn test
27+
- yarn lint
28+
- stage: 'Release'
29+
if: type = push AND branch = master
30+
language: node_js
31+
node_js: lts/*
32+
script: skip
33+
deploy:
34+
provider: script
35+
skip_cleanup: true
36+
script: npx semantic-release

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
## 0.2.0 (Aug 1, 2019)
1+
## [0.2.0](https://github.com/Gusto/apollo-federation-ruby/compare/v0.1.0...v0.2.0) (2019-08-01)
2+
23

34
### Features
45

5-
* Add a description to the `_Service` type ([#10](https://github.com/Gusto/apollo-federation-ruby/pull/10))
6+
* Add a description to the `_Service` type ([b7f19b9](https://github.com/Gusto/apollo-federation-ruby/commit/b7f19b99c385e94d29bed8dd34cc06383ce01ea2))
7+
8+
### Bug Fixes
69

7-
### Bug fixes
10+
* Fix an issue coercing the `_Any` scalar in a Rails app ([39e9213](https://github.com/Gusto/apollo-federation-ruby/commit/39e9213d90bb18c7f218085e1dcaed8f2b6fa835))
811

9-
* Fix an issue coercing the `_Any` scalar in a Rails app ([#13](https://github.com/Gusto/apollo-federation-ruby/pull/13))
12+
## 0.1.0 (2019-06-21)
1013

11-
## 0.1.0 (Jun 21, 2019)
1214

1315
* First release

bin/prepare.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
def set_version
4+
new_version = ARGV[0]
5+
6+
contents = File.read('lib/apollo-federation/version.rb')
7+
8+
new_contents = contents.gsub(/VERSION = '[0-9.]*'/, "VERSION = '#{new_version}'")
9+
File.write('lib/apollo-federation/version.rb', new_contents)
10+
end
11+
12+
def bundle_install
13+
system('bundle install')
14+
end
15+
16+
def build_gem
17+
system('gem build apollo-federation.gemspec')
18+
end
19+
20+
set_version
21+
bundle_install
22+
build_gem

bin/publish.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
new_version = ARGV[0]
4+
gem_name = "apollo-federation-#{new_version}.gem"
5+
system("gem push #{gem_name}")
6+
File.delete(gem_name)

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@
2121
"devDependencies": {
2222
"@babel/core": "7.4.5",
2323
"@babel/preset-env": "7.4.5",
24+
"@semantic-release/changelog": "^3.0.4",
25+
"@semantic-release/exec": "^3.3.5",
26+
"@semantic-release/git": "^7.0.16",
2427
"apollo-server-core": "2.6.3",
2528
"apollo-server-testing": "2.6.3",
2629
"babel-jest": "24.8.0",
2730
"concurrently": "4.1.0",
2831
"eslint-config-gusto": "^9.5.1",
2932
"graphql-tag": "2.10.1",
3033
"jest": "24.8.0",
31-
"nodemon": "1.19.1"
34+
"nodemon": "1.19.1",
35+
"semantic-release": "^15.13.19"
3236
}
3337
}

release.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
plugins: [
3+
'@semantic-release/commit-analyzer',
4+
'@semantic-release/release-notes-generator',
5+
'@semantic-release/changelog',
6+
[
7+
'@semantic-release/exec',
8+
{
9+
// TODO: Verify the presence of the GEM_HOST_API_KEY env var
10+
// verifyConditionsCmd: './verify.sh',
11+
// eslint-disable-next-line no-template-curly-in-string
12+
prepareCmd: 'ruby bin/prepare.rb ${nextRelease.version}',
13+
// eslint-disable-next-line no-template-curly-in-string
14+
publishCmd: 'ruby bin/publish.rb ${nextRelease.version}',
15+
},
16+
],
17+
[
18+
'@semantic-release/git',
19+
{
20+
// eslint-disable-next-line no-template-curly-in-string
21+
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
22+
assets: ['CHANGELOG.md', 'Gemfile.lock', 'lib/apollo-federation/version.rb'],
23+
},
24+
],
25+
'@semantic-release/github',
26+
],
27+
};

0 commit comments

Comments
 (0)