Skip to content

Commit c7c5843

Browse files
authored
chore(tooling): general tooling improvements
chore(tooling): general tooling improvements
2 parents 921981f + fbeec57 commit c7c5843

11 files changed

Lines changed: 209 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ jobs:
1313
max-parallel: 1
1414
matrix:
1515
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
16-
name: Ruby ${{ matrix.ruby }}
16+
name: 💎 Ruby ${{ matrix.ruby }}
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0 # gives the commit linter access to previous commits
21+
22+
- name: Commit message linter
23+
if: ${{ matrix.ruby == '2.5' }}
24+
uses: wagoid/commitlint-github-action@v4
25+
1926
- uses: ruby/setup-ruby@v1
2027
with:
2128
ruby-version: ${{ matrix.ruby }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "The new version number with 'v' prefix. Example: v1.40.1"
8+
required: true
9+
10+
jobs:
11+
init_release:
12+
name: 🚀 Create release PR
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # gives the changelog generator access to all previous commits
18+
19+
- name: Update CHANGELOG.md, version.rb and push release branch
20+
env:
21+
VERSION: ${{ github.event.inputs.version }}
22+
run: |
23+
npx --yes standard-version@9.3.2 --release-as "$VERSION" --skip.tag --skip.commit --tag-prefix=v
24+
git config --global user.name 'github-actions'
25+
git config --global user.email 'release@getstream.io'
26+
git checkout -q -b "release-$VERSION"
27+
git commit -am "chore(release): $VERSION"
28+
git push -q -u origin "release-$VERSION"
29+
30+
- name: Get changelog diff
31+
uses: actions/github-script@v5
32+
with:
33+
script: |
34+
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
35+
core.exportVariable('CHANGELOG', get_change_log_diff())
36+
37+
- name: Open pull request
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
gh pr create \
42+
-t "Release ${{ github.event.inputs.version }}" \
43+
-b "# :rocket: ${{ github.event.inputs.version }}
44+
Make sure to use squash & merge when merging!
45+
Once this is merged, another job will kick off automatically and publish the package.
46+
# :memo: Changelog
47+
${{ env.CHANGELOG }}"

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- master
8+
- main
9+
10+
jobs:
11+
Release:
12+
name: 🚀 Release
13+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: actions/github-script@v5
21+
with:
22+
script: |
23+
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
24+
core.exportVariable('CHANGELOG', get_change_log_diff())
25+
// Getting the release version from the PR source branch
26+
// Source branch looks like this: release-1.0.0
27+
const version = context.payload.pull_request.head.ref.split('-')[1]
28+
core.exportVariable('VERSION', version)
29+
30+
- name: Publish gem
31+
uses: dawidd6/action-publish-gem@v1
32+
with:
33+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
34+
35+
- name: Create release on GitHub
36+
uses: ncipollo/release-action@v1
37+
with:
38+
body: ${{ env.CHANGELOG }}
39+
tag: ${{ env.VERSION }}
40+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reviewdog.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: reviewdog
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
rubocop:
11+
name: 🐶 Reviewdog
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: 3
20+
21+
- name: rubocop
22+
uses: reviewdog/action-rubocop@v2
23+
with:
24+
rubocop_version: gemfile
25+
reporter: github-pr-review

.rspec

Lines changed: 0 additions & 2 deletions
This file was deleted.

.versionrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const versionFileUpdater = {
2+
VERSION_REGEX: /VERSION = '(.+)'/,
3+
4+
readVersion: function (contents) {
5+
const version = this.VERSION_REGEX.exec(contents)[1];
6+
return version;
7+
},
8+
9+
writeVersion: function (contents, version) {
10+
return contents.replace(this.VERSION_REGEX.exec(contents)[0], `VERSION = '${version}'`);
11+
}
12+
}
13+
14+
module.exports = {
15+
bumpFiles: [{ filename: './lib/stream/version.rb', updater: versionFileUpdater }],
16+
}

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
1-
# stream-ruby
1+
# Official Ruby SDK for [Stream Feeds](https://getstream.io/activity-feeds/)
22

33
[![build](https://github.com/GetStream/stream-ruby/workflows/build/badge.svg)](https://github.com/GetStream/stream-ruby/actions) [![Gem Version](https://badge.fury.io/rb/stream-ruby.svg)](http://badge.fury.io/rb/stream-ruby)
44

5-
[stream-ruby](https://github.com/GetStream/stream-ruby) is the official Ruby client for [Stream](https://getstream.io/), a web service for building scalable newsfeeds and activity streams.
5+
<p align="center">
6+
<img src="./assets/logo.svg" width="50%" height="50%">
7+
</p>
8+
<p align="center">
9+
Official Ruby API client for Stream Feeds, a web service for building scalable newsfeeds and activity streams.
10+
<br />
11+
<a href="https://getstream.io/activity-feeds/"><strong>Explore the docs »</strong></a>
12+
<br />
13+
<br />
14+
<a href="https://github.com/GetStream/stream-rails">Code Samples</a>
15+
·
16+
<a href="https://github.com/GetStream/stream-ruby/issues">Report Bug</a>
17+
·
18+
<a href="https://github.com/GetStream/stream-ruby/issues">Request Feature</a>
19+
</p>
620

7-
Note there is also a higher level [Ruby on Rails - Stream integration](https://github.com/getstream/stream-rails) library which hooks into the Ruby on Rails ORM.
21+
## 📝 About Stream
822

9-
You can sign up for a Stream account at https://getstream.io/get_started.
23+
You can sign up for a Stream account at our [Get Started](https://getstream.io/get_started/) page.
1024

11-
#### Ruby version requirements and support
25+
You can use this library to access Feeds API endpoints server-side.
1226

13-
This API Client project requires Ruby 2.5.x at a minimum.
27+
For the client-side integrations (web and mobile) have a look at the JavaScript, iOS and Android SDK libraries ([docs](https://getstream.io/activity-feeds/)).
1428

15-
See the [Travis configuration](.travis.yml) for details of how it is built and tested.
29+
> 💡 This API Client project requires Ruby 2.5.x at a minimum.
1630
17-
### Installation
31+
## ⚙️ Installation
1832

1933
```bash
2034
gem install 'stream-ruby'
2135
```
2236

23-
### Full documentation
37+
38+
## 📚 Full documentation
2439

2540
Documentation for this Ruby client are available at the [Stream website](https://getstream.io/docs/ruby/?language=ruby).
2641

27-
### Usage
42+
## ✨ Getting started
2843

2944
```ruby
3045
# Instantiate a new client to connect to us east API endpoint
@@ -151,11 +166,12 @@ client.add_to_many(activity, feeds)
151166
client.og('https://google.com')
152167
```
153168

154-
### Copyright and License Information
155-
169+
## ✍️ Contributing
156170
Project is licensed under the [BSD 3-Clause](LICENSE).
157171

158-
## We are hiring!
172+
We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our [license file](./LICENSE) for more details.
173+
174+
## 🧑‍💻 We are hiring!
159175

160176
We've recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and we keep actively growing.
161177
Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

assets/logo.svg

Lines changed: 16 additions & 0 deletions
Loading

scripts/get_changelog_diff.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Here we're trying to parse the latest changes from CHANGELOG.md file.
3+
The changelog looks like this:
4+
5+
## 0.0.3
6+
- Something #3
7+
## 0.0.2
8+
- Something #2
9+
## 0.0.1
10+
- Something #1
11+
12+
In this case we're trying to extract "- Something #3" since that's the latest change.
13+
*/
14+
module.exports = () => {
15+
const fs = require('fs')
16+
17+
changelog = fs.readFileSync('CHANGELOG.md', 'utf8')
18+
releases = changelog.match(/## [?[0-9](.+)/g)
19+
20+
current_release = changelog.indexOf(releases[0])
21+
previous_release = changelog.indexOf(releases[1])
22+
23+
latest_changes = changelog.substr(current_release, previous_release - current_release)
24+
25+
return latest_changes
26+
}

stream.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
1515
gem.license = 'BSD-3-Clause'
1616
gem.required_ruby_version = '>=2.5.0'
1717
gem.metadata = {
18+
'rubygems_mfa_required' => 'false',
1819
'homepage_uri' => 'https://getstream.io/activity-feeds/',
1920
'bug_tracker_uri' => 'https://github.com/GetStream/stream-ruby/issues',
2021
'documentation_uri' => 'https://getstream.io/activity-feeds/docs/ruby/?language=ruby',

0 commit comments

Comments
 (0)