diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..67e7253e --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 3c1dd2d2..00000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: build - -on: [push] - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - build: - name: Release build and publish - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Restore cache - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Test - if: startsWith(github.ref , 'refs/tags/') != true - env: - STREAM_KEY: ${{ secrets.STREAM_KEY }} - STREAM_SECRET: ${{ secrets.STREAM_SECRET }} - run: | - ./gradlew spotlessCheck --no-daemon - ./gradlew test --no-daemon - - - name: Publish to MavenCentral - if: startsWith(github.ref, 'refs/tags/') - 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 }} diff --git a/.github/workflows/initiate_release.yml b/.github/workflows/initiate_release.yml new file mode 100644 index 00000000..9233cfcd --- /dev/null +++ b/.github/workflows/initiate_release.yml @@ -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 }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b5bb0739 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.versionrc.js b/.versionrc.js new file mode 100644 index 00000000..2367c93c --- /dev/null +++ b/.versionrc.js @@ -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 }], +} diff --git a/README.md b/README.md index 4aa6898d..68c429fe 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,32 @@ -# stream-java [](https://maven-badges.herokuapp.com/maven-central/io.getstream.client/stream-java) [](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). +[](https://github.com/GetStream/stream-java/actions) -You can sign up for a Stream account at https://getstream.io/get_started. +
+
+
+ Official Java API client for Stream Feeds, a web service for building scalable newsfeeds and activity streams.
+
+ Explore the docs Β»
+
+
+ JavaDoc
+ Β·
+ Report Bug
+ Β·
+ Request Feature
+