Skip to content

Commit f7411aa

Browse files
chore: adjust release process (GetStream#2125)
### 🎯 Goal - make documentation publishing part of the release process, add option to publish documentation without triggering the release of the package - release docs from ANY branch (no limitation) - release to either of the two options (prod or staging) - add PR title check (like we have in `stream-video-js`) I have already changed [the release process](GetStream@bd32b26) to `workflow_dispatch` - this is just the extension of that commit that takes the documentation into consideration. Obviously this commit should be followed by the removal of the `develop` branch which is no longer needed. By doing that we won't be confusing `semantic-release` which relies on merged commits do do the comparisons: https://github.com/GetStream/stream-chat-react/blob/2145665ef7f872a3c0c82ceb2b9a2f9290ffc8b0/CHANGELOG.md?plain=1#L1-L16 Releasing on `rc` withouth prior merge of `master` -> `develop` -> `rc` caused an issue where a feature that has been already released has been added to the `CHANGELOG.md` as new feature. This process adjustment should reduce the unnecessary overhead. --------- Co-authored-by: MartinCupela <32706194+MartinCupela@users.noreply.github.com>
1 parent bd32b26 commit f7411aa

File tree

4 files changed

+77
-58
lines changed

4 files changed

+77
-58
lines changed

.github/workflows/docusaurus.yml

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

.github/workflows/pr-check.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check PR title
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: aslafy-z/conventional-pr-title-action@v3
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@ name: Release
22
on:
33
workflow_dispatch:
44
inputs:
5+
docs_only:
6+
description: Skip package release and publish documentation only
7+
default: false
8+
type: boolean
59
dry_run:
6-
description: 'Run semantic-release in "dry run" mode'
10+
description: Run package release in "dry run" mode (does not publish)
711
default: false
812
type: boolean
13+
docs_env:
14+
description: Pick environment to publish documentation to
15+
required: true
16+
type: choice
17+
default: staging
18+
options:
19+
- production
20+
- staging
921

10-
env:
11-
NODE_OPTIONS: --max_old_space_size=4096
1222
jobs:
13-
release:
14-
name: Release
23+
package_release:
24+
name: Release from "${{ github.ref_name }}" branch
1525
runs-on: ubuntu-latest
1626
# GH does not allow to limit branches in the workflow_dispatch settings so this here is a safety measure
17-
if: ${{ github.ref_name == 'master' || github.ref_name == 'rc' || github.ref_name == 'release-v9' }}
27+
if: ${{ inputs.docs_only == 'false' || github.ref_name == 'master' || github.ref_name == 'rc' || github.ref_name == 'release-v9' }}
28+
env:
29+
NODE_OPTIONS: --max_old_space_size=4096
1830
steps:
1931
- name: Checkout
2032
uses: actions/checkout@v3
@@ -35,3 +47,27 @@ jobs:
3547
run: >
3648
yarn semantic-release
3749
${{ inputs.dry_run && '--dry-run' || '' }}
50+
51+
docs_release:
52+
name: Publish documentation from "${{ github.ref_name }}" branch to ${{ inputs.docs_env }}
53+
runs-on: ubuntu-latest
54+
if: ${{ inputs.dry_run == 'false' }}
55+
outputs:
56+
target-version: $${{ steps.target-version.outputs }}
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v3
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v3
62+
with:
63+
node-version: 20
64+
- name: Install dependencies
65+
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
66+
- name: Merge shared "@stream-io/stream-chat-css" docs
67+
run: bash scripts/merge-stream-chat-css-docs.sh node_modules/@stream-io/stream-chat-css/docs
68+
- name: Push to stream-chat-docusaurus
69+
uses: GetStream/push-stream-chat-docusaurus-action@main
70+
with:
71+
target-branch: ${{ inputs.docs_env }}
72+
env:
73+
DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}

developers/RELEASE.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
# Release
1+
# Release process (for package and documentation)
2+
23
The `stream-chat-react` package follows semantic versioning and the release is to a big part automated by `semantic-release`. The utility automates:
34

4-
1. Collects release notes from the commits added since the last release
5-
2. Creates a [GitHub release](https://github.com/GetStream/stream-chat-react/releases)
6-
3. Appends release notes to `CHANGELOG.md`
7-
4. Publishes a new package version to NPM.
5+
1. release notes collection from the commits added since the last release
6+
2. [GitHub release](https://github.com/GetStream/stream-chat-react/releases) creation
7+
3. release notes (`CHANGELOG.md`) update
8+
4. version bump and package release to the NPM
9+
10+
In order to get the above generated outputs, each contributor should follow [Angular's Commit Message Format rules](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format).
11+
12+
## Required steps
813

9-
In order the above generates correct outputs, each contributor should [Angular's Commit Messag Format rules](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format).
14+
At the moment these manual actions have to be taken to achieve a successfull release:
1015

11-
At the moment these manual actions have to be taken while doing a release:
16+
1. make sure that all the new required features and bug fixes in peer dependency repositories `@stream-io/stream-chat-css` and `stream-chat-js` are released
17+
2. make sure that the peer dependencies `@stream-io/stream-chat-css` and `stream-chat-js` are installed at their latest version (see `package.json`, `yarn.lock`) (if applicable)
18+
3. squash-merge required pull requests to `master` branch with appropriate message name, for example: `fix(scope): new feature`, if this feature is breaking, make sure to include `BREAKING CHANGE: <reason>` in the message footer
19+
4. navigate to ["Actions"](https://github.com/GetStream/stream-chat-react/actions) and in the left bar select the "Release" workflow
20+
5. click "Run workflow" and select the branch you want to release from then adjust the prompt options and click "Run workflow", note that allowed branches for __PACKAGE RELEASE__ are: `master`, `release-v9` and `rc`, there's _is no such limititation_ for the __DOCUMENTATION RELEASE__, extend the workflow condition and `.releaserc.json` as needed
1221

13-
0. Make sure that all the new required features and bug fixes in peer dependency repositories `@stream-io/stream-chat-css` and `stream-chat-js` are released
14-
1. Make sure that the peer dependencies `@stream-io/stream-chat-css` and `stream-chat-js` are installed at their latest version (see `package.json`, `yarn.lock`)
15-
2. Create a new PR request from `develop` to `master` branch.
16-
- The PR name should correspond to the next package version that is to be released (e.g. v1.1, v8, v9.1.2). You can use GitHub's CLI utility (e.g. `gh pr create —base master`)
17-
- The PR description should list all the changes in form of commit messages (therefore we require squashing the commit history when merging into `develop`).
18-
3. Solve potential conflicts between the two branches
19-
- As `master` receives updates only from `develop`, there should be no conflicts.
20-
4. Merge the PR and make sure that:
21-
- the `CHANGELOG.md` file has been correctly updated
22-
- a new (correct) version of the package has been published at NPM
23-
- a new release with correct version number has be created in GitHub
22+
## Available release prompt options
23+
24+
- `docs_only` option if checked will skip the `package_release` job and will only run the `docs_release`
25+
- `dry_run` option if checked will run the `semantic-release` command in ["dry run" mode](https://semantic-release.gitbook.io/semantic-release/usage/configuration#dryrun) and will skip `docs_release`
26+
- `docs_env` (required) option offers two environment options to which the documentation will be pushed to via `GetStream/push-stream-chat-docusaurus-action` - defaults to `staging`
2427

2528
## After the release
29+
2630
We maintain multiple demo applications developed with `stream-chat-react`. With each new version of the package, the applications should have their dependencies upgraded explicitly in their `package.json`.
2731

2832
The demo apps repositories are:

0 commit comments

Comments
 (0)