mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
feat: pre-release workflow (#2910)
* feat(workflow): pre-release * feat(workflow): exit pre-release * chore(workflow): update version & publish commands * fix(workflow): add missing attributes and use schangeset:beta cmd * feat(root): add changeset:beta * fix(workflows): revise pre-release logic * fix(workflows): add missing run * fix(workflows): use changeset:exit with version instead * feat(root): add changeset:exit cmd * refactor(workflows): add pths, id, and format * feat(workflows): enter pre-release mode * chore(workflows): remove pre.json only * refactor(workflows): remove enter-pre-release-mode * fix(workflows): incorrect url * refactor(root): remove unused exit command * refactor(workflows): add comments * feat(changeset): change to main branch as baseBranch * feat(root): add changeset:canary * refactor(workflows): remove unused workflow * feat(workflow): support canary pre-release mode * refactor(docs): change to canary
This commit is contained in:
parent
7c2c9c4875
commit
80f6cf5a7b
@ -8,7 +8,7 @@
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "public",
|
||||
"baseBranch": "canary",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
|
||||
"onlyUpdatePeerDependentsWhenOutOfRange": true
|
||||
|
||||
33
.github/workflows/enter-pre-release-mode.yaml
vendored
Normal file
33
.github/workflows/enter-pre-release-mode.yaml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: Enter pre-release mode
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
enter-pre-release-mode:
|
||||
if: ${{ github.ref == 'refs/heads/beta/release-next' || github.ref == 'refs/heads/canary' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/common-actions/install
|
||||
|
||||
- name: Enter pre-release mode
|
||||
id: enter-pre-release-mode
|
||||
run: |
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "github-actions[bot]"
|
||||
if [ ${{ github.ref }} == 'refs/heads/canary' ]; then
|
||||
pnpm changeset:canary
|
||||
else
|
||||
pnpm changeset:beta
|
||||
fi
|
||||
git add -A
|
||||
git commit -m 'chore(pre-release): enter pre-release mode'
|
||||
git push
|
||||
37
.github/workflows/exit-pre-release.yaml
vendored
Normal file
37
.github/workflows/exit-pre-release.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Exit pre-release mode
|
||||
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
exit-pre-release-mode:
|
||||
if: ${{ github.ref == 'refs/heads/beta/release-next' || github.ref == 'refs/heads/canary' }}
|
||||
name: exit pre-release mode
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/common-actions/install
|
||||
|
||||
- name: remove pre.json
|
||||
# we only remove .changeset/pre.json here
|
||||
# since we want to keep the changeset files introduced in beta/release-next or canary branch
|
||||
# once we merge it to canary / main, those files will be removed in version PR in canary
|
||||
# and converted to corresponding changelogs
|
||||
run: npx rimraf .changeset/pre.json
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "github-actions[bot]"
|
||||
git add -A
|
||||
git commit -m "ci(changesets): exit pre-release mode"
|
||||
git push
|
||||
64
.github/workflows/pre-release.yaml
vendored
Normal file
64
.github/workflows/pre-release.yaml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Pre-release
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".changeset/**"
|
||||
- "packages/**"
|
||||
branches:
|
||||
- "beta/release-next"
|
||||
- "canary"
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
prerelease:
|
||||
name: changesets pre-release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/common-actions/install
|
||||
|
||||
- name: Check if pre.json exists
|
||||
id: check_if_pre_json_exists
|
||||
uses: andstor/file-existence-action@v3.0.0
|
||||
with:
|
||||
files: ".changeset/pre.json"
|
||||
|
||||
- name: Get pre-release changesets
|
||||
id: get-pre-release-changesets
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
path: ".changeset/pre.json"
|
||||
prop_path: "changesets"
|
||||
|
||||
- name: Create pre-release PR
|
||||
id: create-pre-release-pr
|
||||
if: "${{ steps.check_if_pre_json_exists.outputs.files_exists == 'true' && !startsWith(github.event.head_commit.message, 'ci(changesets): version packages') }}"
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
version: pnpm run version
|
||||
title: "ci(changesets): :package: version packages"
|
||||
commit: "ci(changesets): version packages"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish to NPM
|
||||
id: publish-to-npm
|
||||
if: "${{ steps.check_if_pre_json_exists.outputs.files_exists == 'true' && contains(github.event.head_commit.message, 'ci(changesets): :package: version packages') }}"
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
publish: pnpm run release
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
23
.github/workflows/release.yaml
vendored
23
.github/workflows/release.yaml
vendored
@ -6,7 +6,7 @@ on:
|
||||
- ".changeset/**"
|
||||
- "packages/**"
|
||||
branches:
|
||||
- canary
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@ -39,23 +39,4 @@ jobs:
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- 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 canary
|
||||
pnpm version:canary
|
||||
pnpm release:canary
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
43
.github/workflows/sync-canary-to-main.yaml
vendored
43
.github/workflows/sync-canary-to-main.yaml
vendored
@ -1,43 +0,0 @@
|
||||
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@v4
|
||||
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.
|
||||
@ -148,14 +148,14 @@ export const useSandpack = ({
|
||||
|
||||
// if (hasComponents) {
|
||||
// let deps = {
|
||||
// "@nextui-org/theme": "dev-v2",
|
||||
// "@nextui-org/system": "dev-v2",
|
||||
// "@nextui-org/theme": "canary",
|
||||
// "@nextui-org/system": "canary",
|
||||
// };
|
||||
|
||||
// nextUIComponents.forEach((component) => {
|
||||
// deps = {
|
||||
// ...deps,
|
||||
// [`@nextui-org/${component}`]: "dev-v2",
|
||||
// [`@nextui-org/${component}`]: "canary",
|
||||
// };
|
||||
// });
|
||||
|
||||
@ -164,7 +164,7 @@ export const useSandpack = ({
|
||||
|
||||
// return {
|
||||
// ...deps,
|
||||
// "@nextui-org/react": "dev-v2",
|
||||
// "@nextui-org/react": "canary",
|
||||
// };
|
||||
// }, [hasComponents, nextUIComponents, component]);
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ fs.readFile("./package.json", "utf8", function (err, data) {
|
||||
// Check if the package is in the @nextui-org namespace and has "workspace:*" as its version
|
||||
if (pkg.startsWith("@nextui-org/") && packageJson.dependencies[pkg] === "workspace:*") {
|
||||
// Get the latest version of the package under the specified tag
|
||||
const latestVersion = execSync(`npm show ${pkg}@dev-v2 version`, {encoding: "utf8"}).trim();
|
||||
const latestVersion = execSync(`npm show ${pkg}@canary version`, {encoding: "utf8"}).trim();
|
||||
|
||||
// Replace the version in the package.json file
|
||||
packageJson.dependencies[pkg] = latestVersion;
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
"create:cmp": "plop component",
|
||||
"create:pkg": "plop package",
|
||||
"create:hook": "plop hook",
|
||||
"changeset:canary": "changeset pre enter canary",
|
||||
"changeset:beta": "changeset pre enter beta",
|
||||
"version": "changeset version",
|
||||
"release": "changeset publish",
|
||||
"version:canary": "changeset version --snapshot canary",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user