Skip to content

Commit a927807

Browse files
authored
chore(maintenance): general maintenance (#107)
1 parent 484fc37 commit a927807

File tree

8 files changed

+224
-72
lines changed

8 files changed

+224
-72
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: build
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
name: 🧪 Test & lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Commit message lint
20+
uses: wagoid/commitlint-github-action@v4
21+
22+
- name: Restore cache
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.gradle/caches
26+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
27+
restore-keys: |
28+
${{ runner.os }}-gradle-
29+
30+
- name: Test
31+
env:
32+
STREAM_KEY: ${{ secrets.STREAM_KEY }}
33+
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
34+
run: |
35+
./gradlew spotlessCheck --no-daemon
36+
./gradlew test --no-daemon

.github/workflows/gradle.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.
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. Example: 1.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, build.gradle and push release branch
20+
env:
21+
VERSION: ${{ github.event.inputs.version }}
22+
run: |
23+
npx --yes [email protected] --release-as "$VERSION" --skip.tag --skip.commit --tag-prefix=
24+
git config --global user.name 'github-actions'
25+
git config --global user.email '[email protected]'
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: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
Release:
11+
name: 🚀 Release
12+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/github-script@v5
20+
with:
21+
script: |
22+
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
23+
core.exportVariable('CHANGELOG', get_change_log_diff())
24+
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 to MavenCentral
31+
run: |
32+
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
33+
./gradlew publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
34+
env:
35+
STREAM_KEY: ${{ secrets.STREAM_KEY }}
36+
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
37+
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
38+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
39+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
40+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
41+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
42+
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
43+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
44+
45+
- name: Create release on GitHub
46+
uses: ncipollo/release-action@v1
47+
with:
48+
body: ${{ env.CHANGELOG }}
49+
tag: ${{ env.VERSION }}
50+
token: ${{ secrets.GITHUB_TOKEN }}

.versionrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const gradleUpdater = {
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: './build.gradle', updater: gradleUpdater }],
16+
}

README.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
# stream-java [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.getstream.client/stream-java/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/io.getstream.client/stream-java) [![build](https://github.com/GetStream/stream-java/workflows/build/badge.svg)](https://github.com/GetStream/stream-java/actions)
1+
# Official Java SDK for [Stream Feeds](https://getstream.io/activity-feeds/)
22

3-
[stream-java](https://github.com/GetStream/stream-java) is a Java feed client for [Stream](https://getstream.io/). At the moment, there is no pure Java client for chat but you can find REST docs [here](https://getstream.io/chat/docs_rest/) and an Android specific implementation in Kotlin can be seen [here](https://github.com/GetStream/stream-chat-android).
3+
[![build](https://github.com/GetStream/stream-java/workflows/build/badge.svg)](https://github.com/GetStream/stream-java/actions)
44

5-
You can sign up for a Stream account at https://getstream.io/get_started.
5+
<p align="center">
6+
<img src="./assets/logo.svg" width="50%" height="50%">
7+
</p>
8+
<p align="center">
9+
Official Java 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/docs/?language=java"><strong>Explore the docs »</strong></a>
12+
<br />
13+
<br />
14+
<a href="https://getstream.github.io/stream-java/">JavaDoc</a>
15+
·
16+
<a href="https://github.com/GetStream/stream-java/issues">Report Bug</a>
17+
·
18+
<a href="https://github.com/GetStream/stream-java/issues">Request Feature</a>
19+
</p>
620

7-
---
21+
## 📝 About Stream
822

9-
### Installation
23+
You can sign up for a Stream account at our [Get Started](https://getstream.io/chat/get_started/) page.
24+
25+
You can use this library to access feeds API endpoints server-side.
26+
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/)).
28+
29+
## ⚙️ Installation
1030

1131
Add the following dependency to your `pom.xml`:
1232

@@ -29,15 +49,9 @@ you can download it from [here](https://github.com/GetStream/stream-java/release
2949

3050
Snapshots of the development version are available in [Sonatype](https://oss.sonatype.org/content/repositories/snapshots/io/getstream/client/) snapshots repository.
3151

32-
---
33-
34-
### JDK / JVM version requirements
52+
> 💡This API Client project requires Java SE 7.
3553
36-
This API Client project requires Java SE 7.
37-
38-
---
39-
40-
### FAQ
54+
## 🙋 FAQ
4155

4256
1. Is Android supported?
4357

@@ -49,31 +63,26 @@ If you're using proguard, ensure having following: `-keep class io.getstream.cor
4963

5064
Additionally, we're using Jackson JSON processor and see [their definitions](https://github.com/FasterXML/jackson-docs/wiki/JacksonOnAndroid) too unless you're already using it.
5165

52-
---
53-
54-
### Full documentation
66+
## 📚 Full documentation
5567

5668
Documentation for this Java client are available at the [Stream website](https://getstream.io/docs/?language=java).
5769

58-
For examples have a look [here](https://github.com/GetStream/stream-java/tree/master/example/Example.java).
70+
For examples have a look [here](./example/Example.java).
5971

6072
Docs are available on [GetStream.io](https://getstream.io/docs/?language=java).
6173

6274
JavaDoc is available [here](https://getstream.github.io/stream-java/).
6375

64-
---
65-
66-
### Building & Testing
76+
## 🧪 Building & Testing
6777

6878
Run `gradlew test` to execute integration tests
6979

70-
---
7180

72-
### Copyright and License Information
81+
## ✍️ Contributing
7382

74-
Project is licensed under the [BSD 3-Clause](LICENSE).
83+
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.
7584

76-
## We are hiring!
85+
## 🧑‍💻 We are hiring!
7786

7887
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.
7988
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+
}

0 commit comments

Comments
 (0)