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
This commit is contained in:
աӄա 2024-04-28 22:35:45 +08:00 committed by GitHub
parent 1a033fe6f8
commit f07de03ad1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 67 additions and 15 deletions

View File

@ -8,7 +8,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "canary",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true

View File

@ -14,7 +14,7 @@ reviews:
drafts: false
base_branches:
- "main"
- "develop"
- "canary"
- "fix/.*"
- "chore/.*"
- "feat/.*"

View File

@ -3,7 +3,7 @@ name: QA
on:
pull_request:
branches:
- main
- canary
jobs:
build:

View File

@ -6,7 +6,7 @@ on:
- ".changeset/**"
- "packages/**"
branches:
- main
- canary
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -41,12 +41,21 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create @dev release
- name: Sync files from canary to main branch if a publish happens
if: steps.changesets.outputs.published == 'true'
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/owner/repo/dispatches \
-d '{"event_type":"sync-canary-to-main"}'
- name: Create canary release
if: steps.changesets.outputs.published != 'true'
run: |
git checkout main
pnpm version:dev
pnpm release:dev
git checkout canary
pnpm version:canary
pnpm release:canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,43 @@
name: Sync Canary to Main
on:
# triggered manually in Github
workflow_dispatch:
# triggered by the type "sync-canary-to-main" (e.g. from release action after publishing)
repository_dispatch:
types: [sync-canary-to-main]
jobs:
create_pull_request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure all history is fetched
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: "canary"
destination_branch: "main"
pr_title: "Auto-sync Canary to Main"
pr_body: |
## Automated: Sync from Canary to Main
This Pull Request is automatically generated to sync the changes from the Canary branch to the Main branch. Below are the included updates:
### Triggered by a Direct Push to Canary:
- Please check the recent commits on the Canary branch directly as this sync may include multiple changes.
### Triggered by a Pull Request Merge:
- Merged Pull Request: [PR#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.pull_request.title }}
- PR Description: ${{ github.event.pull_request.body }}
- Merged by: ${{ github.event.pull_request.merged_by.login }}
### Action Required:
- Please review the changes carefully.
- Approve and merge the Pull Request if everything is in order.
Thank you for maintaining the Main branch updated and clean.

View File

@ -57,7 +57,7 @@ https://www.conventionalcommits.org/ or check out the
## Pull Request Guidelines
- The `main` branch is basically a snapshot of the latest stable version. All development must be done in dedicated branches.
- 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.
- Make sure that Github Actions are green
- It is good to have multiple small commits while working on the PR. We'll let GitHub squash it automatically before the merge.
- If you add a new feature:
@ -73,14 +73,14 @@ https://www.conventionalcommits.org/ or check out the
1. Fork of the nextui repository and clone your fork
2. Create a new branch out of the `main` branch. We follow the convention
2. Create a new branch out of the `canary` branch. We follow the convention
`[type/scope]`. For example `fix/dropdown-hook` or `docs/menu-typo`. `type`
can be either `docs`, `fix`, `feat`, `build`, or any other conventional
commit type. `scope` is just a short id that describes the scope of work.
3. Make and commit your changes following the
[commit convention](https://github.com/nextui-org/nextui/blob/main/CONTRIBUTING.md#commit-convention).
As you develop, you can run `pnpm build --filter=<module>` and
As you canary, you can run `pnpm build --filter=<module>` and
`pnpm test packages/<module>/<pkg>` e.g. `pnpm build --filter=avatar & pnpm test packages/components/avatar` to make sure everything works as expected.
> 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
6. Send your pull request:
- Send your pull request to the `main` branch
- Send your pull request to the `canary` branch
- Your pull request will be reviewed by the maintainers and the maintainers will decide if it is accepted or not
- Once the pull request is accepted, the maintainers will merge it to the `main` branch
- Once the pull request is accepted, the maintainers will merge it to the `canary` branch
## Visual Changes

View File

@ -46,8 +46,8 @@
"create:hook": "plop hook",
"version": "changeset version",
"release": "changeset publish",
"version:dev": "changeset version --snapshot dev-v2",
"release:dev": "changeset publish --snapshot --no-git-tag --tag dev-v2",
"version:canary": "changeset version --snapshot canary",
"release:canary": "changeset publish --snapshot --no-git-tag --tag canary",
"postinstall": "husky install && pnpm --filter @nextui-org/theme build"
},
"devDependencies": {