-
Notifications
You must be signed in to change notification settings - Fork 80
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
1 parent
1d846c8
commit 8a57f42
Showing
11 changed files
with
2,462 additions
and
219 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,42 +1,35 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
inputs: | ||
dry_run: | ||
description: Run package release in "dry run" mode (does not publish) | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
Release: | ||
name: 🚀 Release | ||
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-') | ||
package_release: | ||
name: Release From "${{ github.ref_name }}" Branch | ||
runs-on: ubuntu-latest | ||
# GH does not allow to limit branches in the workflow_dispatch settings so this here is a safety measure | ||
if: ${{ inputs.dry_run || startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master') }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/github-script@v6 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
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 | ||
node-version: 22 | ||
- name: Install Dependencies & Build | ||
run: yarn install --frozen-lockfile | ||
- name: Release | ||
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 }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
# https://github.com/stream-ci-bot | ||
GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} | ||
HUSKY: 0 | ||
run: > | ||
yarn semantic-release | ||
${{ inputs.dry_run && '--dry-run' || '' }} |
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,81 @@ | ||
{ | ||
"branches": [ | ||
{ | ||
"name": "master", | ||
"channel": "latest" | ||
}, | ||
{ | ||
"name": "release-v8", | ||
"channel": "v8", | ||
"range": "8.x" | ||
} | ||
], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "angular", | ||
"releaseRules": [ | ||
{ "type": "chore", "scope": "deps", "release": "patch" }, | ||
{ "type": "refactor", "release": "patch" } | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits", | ||
"presetConfig": { | ||
"types": [ | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "feat", | ||
"section": "Features", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "chore", | ||
"scope": "deps", | ||
"section": "Chores", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "refactor", | ||
"section": "Refactors", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "perf", | ||
"section": "Performance Improvements", | ||
"hidden": false | ||
} | ||
] | ||
} | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "NEXT_VERSION=${nextRelease.version} npm run build" | ||
} | ||
], | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogFile": "./CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["./CHANGELOG.md"] | ||
} | ||
], | ||
"@semantic-release/github", | ||
"@semantic-release/npm" | ||
] | ||
} |
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,23 @@ | ||
import { execSync } from 'node:child_process'; | ||
import packageJson from '../package.json' with { type: 'json' }; | ||
|
||
// Get the latest version so that magic string __STREAM_CHAT_REACT_VERSION__ can be replaced with it in the source code (used for reporting purposes) | ||
export default function getPackageVersion() { | ||
let version; | ||
// During release, use the version being released | ||
// see .releaserc.json where the `NEXT_VERSION` env variable is set | ||
if (process.env.NEXT_VERSION) { | ||
version = process.env.NEXT_VERSION; | ||
} else { | ||
// Otherwise use the latest git tag | ||
try { | ||
version = execSync('git describe --tags --abbrev=0').toString().trim(); | ||
} catch (error) { | ||
console.error(error); | ||
console.warn('Could not get latest version from git tags, falling back to package.json'); | ||
version = packageJson.version; | ||
} | ||
} | ||
console.log(`Determined the build package version to be ${version}`); | ||
return version; | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.