Skip to content
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
name: 🧪 Test & lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Commit message lint
uses: wagoid/commitlint-github-action@v4

- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Test
env:
STREAM_KEY: ${{ secrets.STREAM_KEY }}
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
run: |
./gradlew spotlessCheck --no-daemon
./gradlew test --no-daemon
48 changes: 0 additions & 48 deletions .github/workflows/gradle.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/initiate_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create release PR

on:
workflow_dispatch:
inputs:
version:
description: "The new version number. Example: 1.40.1"
required: true

jobs:
init_release:
name: 🚀 Create release PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # gives the changelog generator access to all previous commits

- name: Update CHANGELOG.md, build.gradle and push release branch
env:
VERSION: ${{ github.event.inputs.version }}
run: |
npx --yes standard-version@9.3.2 --release-as "$VERSION" --skip.tag --skip.commit --tag-prefix=
git config --global user.name 'github-actions'
git config --global user.email 'release@getstream.io'
git checkout -q -b "release-$VERSION"
git commit -am "chore(release): $VERSION"
git push -q -u origin "release-$VERSION"

- name: Get changelog diff
uses: actions/github-script@v5
with:
script: |
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
core.exportVariable('CHANGELOG', get_change_log_diff())

- name: Open pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
-t "Release ${{ github.event.inputs.version }}" \
-b "# :rocket: ${{ github.event.inputs.version }}
Make sure to use squash & merge when merging!
Once this is merged, another job will kick off automatically and publish the package.
# :memo: Changelog
${{ env.CHANGELOG }}"
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
pull_request:
types: [closed]
branches:
- main

jobs:
Release:
name: 🚀 Release
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/github-script@v5
with:
script: |
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
core.exportVariable('CHANGELOG', get_change_log_diff())

// Getting the release version from the PR source branch
// Source branch looks like this: release-1.0.0
const version = context.payload.pull_request.head.ref.split('-')[1]
core.exportVariable('VERSION', version)

- name: Publish to MavenCentral
run: |
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
./gradlew publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
env:
STREAM_KEY: ${{ secrets.STREAM_KEY }}
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

- name: Create release on GitHub
uses: ncipollo/release-action@v1
with:
body: ${{ env.CHANGELOG }}
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const gradleUpdater = {
VERSION_REGEX: /version = '(.+)'/,

readVersion: function (contents) {
const version = this.VERSION_REGEX.exec(contents)[1];
return version;
},

writeVersion: function (contents, version) {
return contents.replace(this.VERSION_REGEX.exec(contents)[0], `version = '${version}'`);
}
}

module.exports = {
bumpFiles: [{ filename: './build.gradle', updater: gradleUpdater }],
}
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
# 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)
# Official Java SDK for [Stream Feeds](https://getstream.io/activity-feeds/)

[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).
[![build](https://github.com/GetStream/stream-java/workflows/build/badge.svg)](https://github.com/GetStream/stream-java/actions)

You can sign up for a Stream account at https://getstream.io/get_started.
<p align="center">
<img src="./assets/logo.svg" width="50%" height="50%">
</p>
<p align="center">
Official Java API client for Stream Feeds, a web service for building scalable newsfeeds and activity streams.
<br />
<a href="https://getstream.io/activity-feeds/docs/?language=java"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://getstream.github.io/stream-java/">JavaDoc</a>
·
<a href="https://github.com/GetStream/stream-java/issues">Report Bug</a>
·
<a href="https://github.com/GetStream/stream-java/issues">Request Feature</a>
</p>

---
## 📝 About Stream

### Installation
You can sign up for a Stream account at our [Get Started](https://getstream.io/chat/get_started/) page.

You can use this library to access feeds API endpoints server-side.

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/)).

## ⚙️ Installation

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

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

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

---

### JDK / JVM version requirements
> 💡This API Client project requires Java SE 7.

This API Client project requires Java SE 7.

---

### FAQ
## 🙋 FAQ

1. Is Android supported?

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

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.

---

### Full documentation
## 📚 Full documentation

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

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

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

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

---

### Building & Testing
## 🧪 Building & Testing

Run `gradlew test` to execute integration tests

---

### Copyright and License Information
## ✍️ Contributing

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

## We are hiring!
## 🧑‍💻 We are hiring!

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.
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.
Expand Down
16 changes: 16 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions scripts/get_changelog_diff.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Here we're trying to parse the latest changes from CHANGELOG.md file.
The changelog looks like this:

## 0.0.3
- Something #3
## 0.0.2
- Something #2
## 0.0.1
- Something #1

In this case we're trying to extract "- Something #3" since that's the latest change.
*/
module.exports = () => {
const fs = require('fs')

changelog = fs.readFileSync('CHANGELOG.md', 'utf8')
releases = changelog.match(/## [?[0-9](.+)/g)

current_release = changelog.indexOf(releases[0])
previous_release = changelog.indexOf(releases[1])

latest_changes = changelog.substr(current_release, previous_release - current_release)

return latest_changes
}