Skip to content

Commit fc45a6c

Browse files
authored
chore: init release workflow (#86)
1 parent 360fff1 commit fc45a6c

File tree

8 files changed

+193
-0
lines changed

8 files changed

+193
-0
lines changed

.changeset/config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": false,
4+
"commit": false,
5+
"linked": [],
6+
"access": "restricted",
7+
"baseBranch": "main",
8+
"fixed": [["@rslib/*", "rsbuild-plugin-dts"]],
9+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
10+
"onlyUpdatePeerDependentsWhenOutOfRange": true,
11+
"updateInternalDependents": "always"
12+
},
13+
"updateInternalDependencies": "patch",
14+
"ignore": []
15+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release Pull Request
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: choice
8+
description: 'Release Type (next, beta, alpha, latest)'
9+
required: true
10+
default: 'latest'
11+
options:
12+
- next
13+
- beta
14+
- alpha
15+
- latest
16+
17+
jobs:
18+
release:
19+
name: Create Release Pull Request
20+
runs-on: ubuntu-latest
21+
if: github.repository == 'web-infra-dev/rslib'
22+
steps:
23+
- name: Checkout Repo
24+
uses: actions/checkout@master
25+
with:
26+
# This makes Actions fetch only one branch to release
27+
fetch-depth: 10
28+
29+
- name: Install Pnpm
30+
run: corepack enable
31+
32+
- name: Setup Node.js 18
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '18'
36+
cache: 'pnpm'
37+
38+
- name: Install Dependencies
39+
run: pnpm install --ignore-scripts
40+
41+
- name: Create Release Pull Request
42+
uses: web-infra-dev/actions@v2
43+
with:
44+
# this expects you to have a script called release which does a build for your packages and calls changeset publish
45+
version: ${{ github.event.inputs.version || 'latest' }}
46+
versionNumber: 'auto'
47+
type: 'pull request'
48+
tools: 'changeset'
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52+
REPOSITORY: ${{ github.repository }}
53+
REF: ${{ github.ref }}

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: choice
8+
description: 'Release Version (next, beta, alpha, latest)'
9+
required: true
10+
default: 'next'
11+
options:
12+
- next
13+
- beta
14+
- alpha
15+
- latest
16+
branch:
17+
description: 'Release Branch (confirm release branch)'
18+
required: true
19+
default: 'main'
20+
issue_comment:
21+
types: [created]
22+
23+
permissions:
24+
id-token: write
25+
26+
jobs:
27+
release:
28+
name: Release
29+
if: github.repository == 'web-infra-dev/rslib' && github.event_name == 'workflow_dispatch'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 25
36+
37+
- name: Install Pnpm
38+
run: corepack enable
39+
40+
- name: Setup Node.js 18
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: '18'
44+
cache: 'pnpm'
45+
46+
- name: Install Dependencies
47+
run: pnpm install
48+
49+
- name: Release
50+
uses: web-infra-dev/actions@v2
51+
with:
52+
version: ${{ github.event.inputs.version }}
53+
branch: ${{ github.event.inputs.branch }}
54+
type: 'release'
55+
tools: 'changeset'
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
58+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
59+
REPOSITORY: ${{ github.repository }}
60+
REF: ${{ github.ref }}

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,23 @@ pnpm run lint
117117

118118
For VS Code users, you can install the [Biome VS Code extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) to see lints while typing.
119119

120+
# Versioning
121+
122+
We use [changesets](https://github.com/changesets/changesets) to manage version. Currently, all rslib packages will use a fixed unified version.
123+
124+
The release notes are automatically generated by [GitHub releases](https://github.com/web-infra-dev/rslib/releases).
125+
126+
## Releasing
127+
128+
Repository maintainers can publish a new version of all packages to npm.
129+
130+
Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
131+
132+
1. [Create release pull request](https://github.com/web-infra-dev/rslib/actions/workflows/release-pull-request.yml).
133+
2. [Run the release action](https://github.com/web-infra-dev/rslib/actions/workflows/release.yml).
134+
3. [Generate the release notes](https://github.com/web-infra-dev/rslib/releases).
135+
4. Merge the release pull request.
136+
120137
## Caveats
121138

122139
The project is still in its early stages and under active development, so it possible dependents on Rsbuild or Rspack canary versions to test the latest features. The current canary versions are:

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
22
"name": "rslib-monorepo",
33
"private": true,
4+
"workspaces": {
5+
"packages": [
6+
"packages/*"
7+
]
8+
},
49
"scripts": {
510
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* --parallel=10",
611
"build:examples": "cross-env NX_DAEMON=false nx run-many -t build --projects @examples/* --parallel=10",
12+
"change": "changeset",
713
"check-dependency-version": "check-dependency-version-consistency .",
814
"check-spell": "npx cspell",
915
"lint": "biome check . --diagnostic-level=warn && pnpm run check-spell",
@@ -29,6 +35,7 @@
2935
},
3036
"devDependencies": {
3137
"@biomejs/biome": "^1.8.3",
38+
"@changesets/cli": "^2.27.7",
3239
"@modern-js/module-tools": "^2.55.0",
3340
"@types/fs-extra": "^11.0.4",
3441
"@types/node": "~18.19.39",

packages/core/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<picture>
2+
<img alt="Rslib Banner" src="https://assets.rspack.dev/rslib/rslib-banner.png">
3+
</picture>
4+
5+
# Rslib
6+
7+
Rslib is a library build tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
8+
9+
<!-- ## Documentation
10+
11+
https://rslib.dev/ -->
12+
13+
## Contributing
14+
15+
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
16+
17+
## License
18+
19+
Rslib is [MIT licensed](https://github.com/web-infra-dev/rslib/blob/main/LICENSE).

packages/plugin-dts/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<picture>
2+
<img alt="Rslib Banner" src="https://assets.rspack.dev/rslib/rslib-banner.png">
3+
</picture>
4+
5+
# Rslib
6+
7+
Rslib is a library build tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
8+
9+
<!-- ## Documentation
10+
11+
https://rslib.dev/ -->
12+
13+
## Contributing
14+
15+
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
16+
17+
## License
18+
19+
Rslib is [MIT licensed](https://github.com/web-infra-dev/rslib/blob/main/LICENSE).

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)