Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pre-release workflow #2910

Merged
merged 25 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
af39fb5
feat(workflow): pre-release
wingkwong Apr 29, 2024
0cdd89d
feat(workflow): exit pre-release
wingkwong Apr 29, 2024
d7c4bd1
chore(workflow): update version & publish commands
wingkwong Apr 29, 2024
29727a7
fix(workflow): add missing attributes and use schangeset:beta cmd
wingkwong Apr 30, 2024
93714a1
feat(root): add changeset:beta
wingkwong Apr 30, 2024
05acd07
fix(workflows): revise pre-release logic
wingkwong Apr 30, 2024
71cd9a3
fix(workflows): add missing run
wingkwong May 1, 2024
ace6e1b
fix(workflows): use changeset:exit with version instead
wingkwong May 1, 2024
9483258
feat(root): add changeset:exit cmd
wingkwong May 1, 2024
ebf7225
refactor(workflows): add pths, id, and format
wingkwong May 1, 2024
f3289a3
feat(workflows): enter pre-release mode
wingkwong May 2, 2024
6b89d66
chore(workflows): remove pre.json only
wingkwong May 2, 2024
d999a54
refactor(workflows): remove enter-pre-release-mode
wingkwong May 2, 2024
67a3b62
fix(workflows): incorrect url
wingkwong May 2, 2024
bd5ed00
refactor(root): remove unused exit command
wingkwong May 2, 2024
7296151
refactor(workflows): add comments
wingkwong May 2, 2024
f812b62
Merge branch 'canary' into feat/eng-707
wingkwong May 5, 2024
61a74b1
feat(changeset): change to main branch as baseBranch
wingkwong May 5, 2024
888a948
feat(root): add changeset:canary
wingkwong May 5, 2024
d8c8049
refactor(workflows): remove unused workflow
wingkwong May 5, 2024
a5b28bb
feat(workflow): support canary pre-release mode
wingkwong May 5, 2024
08281f6
refactor(docs): change to canary
wingkwong May 10, 2024
a3e219b
Merge branch 'canary' into feat/eng-707
wingkwong May 17, 2024
990a9cd
Merge branch 'canary' into feat/eng-707
wingkwong Jun 25, 2024
9d06e2e
Merge branch 'canary' into feat/eng-707
wingkwong Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "canary",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/enter-pre-release-mode.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions .github/workflows/exit-pre-release.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 64 additions & 0 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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"

wingkwong marked this conversation as resolved.
Show resolved Hide resolved
- 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:
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
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 changes: 2 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- ".changeset/**"
- "packages/**"
branches:
- canary
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -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 changes: 0 additions & 43 deletions .github/workflows/sync-canary-to-main.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions apps/docs/components/sandpack/use-sandpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
// };
// });

Expand All @@ -164,7 +164,7 @@ export const useSandpack = ({

// return {
// ...deps,
// "@nextui-org/react": "dev-v2",
// "@nextui-org/react": "canary",
// };
// }, [hasComponents, nextUIComponents, component]);

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
wingkwong marked this conversation as resolved.
Show resolved Hide resolved

// Replace the version in the package.json file
packageJson.dependencies[pkg] = latestVersion;
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
"version": "changeset version",
"release": "changeset publish",
"version:canary": "changeset version --snapshot canary",
Expand Down