-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
193 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ test/integration/utils/kjur.js | |
/.git/ | ||
/docs/ | ||
**/*.sh | ||
get_changelog_diff.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Create release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The new version number with 'v' prefix. Example: v1.40.1" | ||
required: true | ||
|
||
jobs: | ||
init_release: | ||
name: 🚀 Create release PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # gives the changelog generator access to all previous commits | ||
|
||
- name: Get current tag | ||
id: previoustag | ||
uses: WyriHaximus/github-action-get-previous-tag@v1 | ||
|
||
- name: Ensure version number higher than current | ||
uses: actions/github-script@v5 | ||
env: | ||
PREVIOUS_TAG: ${{ steps.previoustag.outputs.tag }} | ||
DESTINATION_TAG: ${{ github.event.inputs.version }} | ||
with: | ||
script: | | ||
const { PREVIOUS_TAG, DESTINATION_TAG } = process.env; | ||
const result = DESTINATION_TAG.localeCompare(PREVIOUS_TAG, undefined, { numeric: true, sensitivity: 'base' }) | ||
if (result != 1) { | ||
throw new Error('The new version number must be greater than the previous one.') | ||
} | ||
- name: Restore dependencies | ||
uses: ./.github/actions/setup-node | ||
|
||
- name: Update CHANGELOG.md, package.json and push release branch | ||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
run: | | ||
npm run changelog | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
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 "chore(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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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) | ||
- uses: ./.github/actions/setup-node | ||
|
||
- name: Publish package | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Create release on GitHub | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
body: ${{ env.CHANGELOG }} | ||
tag: ${{ env.VERSION }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
# Stream-JS | ||
|
||
[![build](https://github.com/GetStream/stream-js/workflows/build/badge.svg)](https://github.com/GetStream/stream-js/actions) | ||
# Official JavaScript SDK for [Stream Feeds](https://getstream.io/activity-feeds/) | ||
|
||
[![build](https://github.com/GetStream/stream-js/workflows/build/badge.svg)](https://github.com/GetStream/stream-js/actions) | ||
[![NPM](https://nodei.co/npm/getstream.png)](https://nodei.co/npm/getstream/) | ||
|
||
<p align="center"> | ||
<img src="./assets/logo.svg" width="50%" height="50%"> | ||
</p> | ||
<p align="center"> | ||
Official JavaScript 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=javascript"><strong>Explore the docs »</strong></a> | ||
<br /> | ||
<br /> | ||
<a href="https://github.com/GetStream/stream-js/issues">Report Bug</a> | ||
· | ||
<a href="https://github.com/GetStream/stream-js/issues">Request Feature</a> | ||
</p> | ||
|
||
## 📝 About Stream | ||
|
||
[stream-js](https://github.com/GetStream/stream-js) is the official JavaScript client for [Stream](https://getstream.io/), a web service for building scalable newsfeeds and activity streams. | ||
|
||
Note that there is also a [higher level Node integration](https://github.com/getstream/stream-node-orm) which hooks into your ORM. | ||
|
||
You can sign up for a Stream account at https://getstream.io/get_started. | ||
|
||
### Installation | ||
## ⚙️ Installation | ||
|
||
#### Install from NPM/YARN | ||
### Install from NPM/YARN | ||
|
||
```bash | ||
npm install getstream | ||
|
@@ -36,22 +51,22 @@ yarn add getstream | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js_min/getstream.js"></script> | ||
``` | ||
|
||
#### Install by downloading the JS file | ||
### Install by downloading the JS file | ||
|
||
[JS](https://raw.githubusercontent.com/GetStream/stream-js/main/dist/js/getstream.js) / | ||
[Minified JS](https://raw.githubusercontent.com/GetStream/stream-js/main/dist/js_min/getstream.js) | ||
|
||
> :warning: Beware about the version you're pulling. It's the latest by default which can break your app anytime. | ||
### Full documentation | ||
## 📚 Full documentation | ||
|
||
Documentation for this JavaScript client are available at the [Stream website](https://getstream.io/docs/?language=js). | ||
|
||
#### Using with React Native | ||
|
||
This package can be integrated into React Native applications. Remember to not expose the App Secret in browsers, "native" mobile apps, or other non-trusted environments. | ||
|
||
### Usage | ||
## ✨ Getting started | ||
|
||
### API client setup Node | ||
|
||
|
@@ -359,15 +374,15 @@ subscription.cancel(); | |
|
||
Docs are available on [GetStream.io](http://getstream.io/docs/?language=js). | ||
|
||
#### Node version requirements & Browser support | ||
## ⚠️ Node version requirements & Browser support | ||
|
||
This API Client project requires Node.js v10 at a minimum. | ||
|
||
The project is supported in line with the Node.js Foundation Release Working Group. | ||
|
||
See the [github action configuration](.github/workflows/ci.yml) for details of how it is built, tested and packaged. | ||
See the [github action configuration](.github/workflows/) for details of how it is built, tested and packaged. | ||
|
||
## Contributing | ||
## ♻️ Contributing | ||
|
||
See extensive at [test documentation](test/README.md) for your changes. | ||
|
||
|
@@ -377,7 +392,9 @@ You can find generic API documentation enriched by code snippets from this packa | |
|
||
Project is licensed under the [BSD 3-Clause](LICENSE). | ||
|
||
## We are hiring! | ||
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'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. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |