Skip to content

Commit bf6ff31

Browse files
Add setup-node custom action, remove build process from steps
1 parent 9de2198 commit bf6ff31

File tree

2 files changed

+36
-54
lines changed

2 files changed

+36
-54
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Setup
2+
description: Sets up Node and Build SDK
3+
4+
inputs:
5+
node-version:
6+
description: 'Specify Node version'
7+
required: false
8+
default: '22'
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Setup Node
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: ${{ inputs.node-version }}
17+
18+
- name: Set NODE_VERSION env
19+
shell: bash
20+
run: echo "NODE_VERSION=$(node --version)" >> $GITHUB_ENV
21+
22+
- name: Cache dependencies
23+
uses: actions/cache@v4
24+
with:
25+
path: ./node_modules
26+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('./yarn.lock') }}
27+
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile
30+
shell: bash

.github/workflows/release.yml

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,81 +2,33 @@ 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
9-
skip_docs:
10-
description: Skip publishing the documentation
11-
default: false
12-
type: boolean
135
dry_run:
146
description: Run package release in "dry run" mode (does not publish either)
157
default: false
168
type: boolean
17-
docs_env:
18-
description: Pick environment to publish documentation to
19-
required: true
20-
type: choice
21-
default: staging
22-
options:
23-
- production
24-
- staging
259

2610
jobs:
2711
package_release:
2812
name: Release from "${{ github.ref_name }}" branch
2913
runs-on: ubuntu-latest
3014
# GH does not allow to limit branches in the workflow_dispatch settings so this here is a safety measure
31-
if: ${{ !inputs.docs_only && (startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master')) }}
32-
env:
33-
NODE_OPTIONS: --max_old_space_size=4096
15+
if: ${{ inputs.dry_run || startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master') }}
3416
steps:
3517
- name: Checkout
36-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
3719
with:
3820
fetch-depth: 0
39-
- name: Setup Node.js
40-
uses: actions/setup-node@v3
41-
with:
42-
node-version: 20
43-
- name: Install dependencies & Build
44-
run: |
45-
yarn install --frozen-lockfile
46-
yarn run build
21+
22+
- uses: ./.github/actions/setup-node
23+
4724
- name: Validate CommonJS bundle
4825
run: yarn validate-cjs
26+
4927
- name: Release
5028
env:
5129
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5330
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5431
HUSKY: 0
5532
run: >
5633
yarn semantic-release
5734
${{ inputs.dry_run && '--dry-run' || '' }}
58-
59-
docs_release:
60-
name: Publish documentation from "${{ github.ref_name }}" branch to ${{ inputs.docs_env }}
61-
runs-on: ubuntu-latest
62-
# skip during dry runs, publish to production only from master or branches with names starting with "release", publish to staging from anywhere
63-
if: ${{ !inputs.dry_run && !inputs.skip_docs && (((github.ref_name == 'master' || startsWith(github.ref_name, 'release')) && inputs.docs_env == 'production') || inputs.docs_env == 'staging') }}
64-
outputs:
65-
target-version: $${{ steps.target-version.outputs }}
66-
steps:
67-
- name: Checkout
68-
uses: actions/checkout@v3
69-
- name: Setup Node.js
70-
uses: actions/setup-node@v3
71-
with:
72-
node-version: 20
73-
- name: Install dependencies
74-
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
75-
- name: Merge shared "@stream-io/stream-chat-css" docs
76-
run: yarn docs:copy-css-docs
77-
- name: Push to stream-chat-docusaurus
78-
uses: GetStream/push-stream-chat-docusaurus-action@main
79-
with:
80-
target-branch: ${{ inputs.docs_env }}
81-
env:
82-
DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}

0 commit comments

Comments
 (0)