Skip to content

Commit f07de03

Browse files
authored
feat: new gitflow (#2695)
* chore(docs): use develop branch instead of main * chore(workflows): change to develop * chore(.changeset): change baseBranch to develop * feat(workflows): trigger sync-develop-to-main workflow after publish * feat(workflow): add sync develop to main workflow * chore(workflows): add back "or Publish to NPM" * refactor(workflows): rename tag name from dev to canary * refactor: rename dev to canary * refactor: reaname develop to canary * refactor(workflows): change from develop to canary
1 parent 1a033fe commit f07de03

File tree

7 files changed

+67
-15
lines changed

7 files changed

+67
-15
lines changed

.changeset/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"fixed": [],
99
"linked": [],
1010
"access": "public",
11-
"baseBranch": "main",
11+
"baseBranch": "canary",
1212
"updateInternalDependencies": "patch",
1313
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1414
"onlyUpdatePeerDependentsWhenOutOfRange": true

.coderabbit.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ reviews:
1414
drafts: false
1515
base_branches:
1616
- "main"
17-
- "develop"
17+
- "canary"
1818
- "fix/.*"
1919
- "chore/.*"
2020
- "feat/.*"

.github/workflows/QA.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: QA
33
on:
44
pull_request:
55
branches:
6-
- main
6+
- canary
77

88
jobs:
99
build:

.github/workflows/release.yaml

+14-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- ".changeset/**"
77
- "packages/**"
88
branches:
9-
- main
9+
- canary
1010

1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
@@ -41,12 +41,21 @@ jobs:
4141
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343

44-
- name: Create @dev release
44+
- name: Sync files from canary to main branch if a publish happens
45+
if: steps.changesets.outputs.published == 'true'
46+
run: |
47+
curl -X POST \
48+
-H "Accept: application/vnd.github.v3+json" \
49+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
50+
https://api.github.com/repos/owner/repo/dispatches \
51+
-d '{"event_type":"sync-canary-to-main"}'
52+
53+
- name: Create canary release
4554
if: steps.changesets.outputs.published != 'true'
4655
run: |
47-
git checkout main
48-
pnpm version:dev
49-
pnpm release:dev
56+
git checkout canary
57+
pnpm version:canary
58+
pnpm release:canary
5059
env:
5160
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5261
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync Canary to Main
2+
3+
on:
4+
# triggered manually in Github
5+
workflow_dispatch:
6+
# triggered by the type "sync-canary-to-main" (e.g. from release action after publishing)
7+
repository_dispatch:
8+
types: [sync-canary-to-main]
9+
10+
jobs:
11+
create_pull_request:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0 # Ensure all history is fetched
18+
19+
- name: Create Pull Request
20+
uses: repo-sync/pull-request@v2
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
source_branch: "canary"
24+
destination_branch: "main"
25+
pr_title: "Auto-sync Canary to Main"
26+
pr_body: |
27+
## Automated: Sync from Canary to Main
28+
29+
This Pull Request is automatically generated to sync the changes from the Canary branch to the Main branch. Below are the included updates:
30+
31+
### Triggered by a Direct Push to Canary:
32+
- Please check the recent commits on the Canary branch directly as this sync may include multiple changes.
33+
34+
### Triggered by a Pull Request Merge:
35+
- Merged Pull Request: [PR#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.pull_request.title }}
36+
- PR Description: ${{ github.event.pull_request.body }}
37+
- Merged by: ${{ github.event.pull_request.merged_by.login }}
38+
39+
### Action Required:
40+
- Please review the changes carefully.
41+
- Approve and merge the Pull Request if everything is in order.
42+
43+
Thank you for maintaining the Main branch updated and clean.

CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ https://www.conventionalcommits.org/ or check out the
5757

5858
## Pull Request Guidelines
5959

60-
- The `main` branch is basically a snapshot of the latest stable version. All development must be done in dedicated branches.
60+
- The `main` branch is basically a snapshot of the latest production version. All development must be done in dedicated branches and will be merged to `canary` branch.
6161
- Make sure that Github Actions are green
6262
- It is good to have multiple small commits while working on the PR. We'll let GitHub squash it automatically before the merge.
6363
- If you add a new feature:
@@ -73,14 +73,14 @@ https://www.conventionalcommits.org/ or check out the
7373

7474
1. Fork of the nextui repository and clone your fork
7575

76-
2. Create a new branch out of the `main` branch. We follow the convention
76+
2. Create a new branch out of the `canary` branch. We follow the convention
7777
`[type/scope]`. For example `fix/dropdown-hook` or `docs/menu-typo`. `type`
7878
can be either `docs`, `fix`, `feat`, `build`, or any other conventional
7979
commit type. `scope` is just a short id that describes the scope of work.
8080

8181
3. Make and commit your changes following the
8282
[commit convention](https://github.com/nextui-org/nextui/blob/main/CONTRIBUTING.md#commit-convention).
83-
As you develop, you can run `pnpm build --filter=<module>` and
83+
As you canary, you can run `pnpm build --filter=<module>` and
8484
`pnpm test packages/<module>/<pkg>` e.g. `pnpm build --filter=avatar & pnpm test packages/components/avatar` to make sure everything works as expected.
8585

8686
> To know more about the `--filter` option, please check the turborepo [docs](https://turborepo.org/docs/core-concepts/filtering).
@@ -200,9 +200,9 @@ npm run build
200200
201201
6. Send your pull request:
202202

203-
- Send your pull request to the `main` branch
203+
- Send your pull request to the `canary` branch
204204
- Your pull request will be reviewed by the maintainers and the maintainers will decide if it is accepted or not
205-
- Once the pull request is accepted, the maintainers will merge it to the `main` branch
205+
- Once the pull request is accepted, the maintainers will merge it to the `canary` branch
206206

207207
## Visual Changes
208208

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"create:hook": "plop hook",
4747
"version": "changeset version",
4848
"release": "changeset publish",
49-
"version:dev": "changeset version --snapshot dev-v2",
50-
"release:dev": "changeset publish --snapshot --no-git-tag --tag dev-v2",
49+
"version:canary": "changeset version --snapshot canary",
50+
"release:canary": "changeset publish --snapshot --no-git-tag --tag canary",
5151
"postinstall": "husky install && pnpm --filter @nextui-org/theme build"
5252
},
5353
"devDependencies": {

0 commit comments

Comments
 (0)