Skip to content

Commit

Permalink
Merge branch 'storybookjs:next' into iqbal
Browse files Browse the repository at this point in the history
  • Loading branch information
iqbalcodes6602 authored Jul 12, 2023
2 parents 31cfea1 + a930066 commit b55179f
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 68 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ jobs:
git config --global user.email '[email protected]'
yarn release:pick-patches
- name: Bump version
- name: Bump version deferred
id: bump-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
run: |
yarn release:version --release-type patch --verbose
yarn release:version --deferred --release-type patch --verbose
# We need the current version to set the branch name, even when not bumping the version
- name: Get current version
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
git config --global user.email '[email protected]'
git checkout -b version-patch-from-${{ steps.versions.outputs.current }}
git add .
git commit -m "Bump version from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.next }}" || true
git commit -m "Write changelog for ${{ steps.versions.outputs.next }}" || true
git push --force origin version-patch-from-${{ steps.versions.outputs.current }}
- name: Generate PR description
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prepare-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ jobs:
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Bump version
- name: Bump version deferred
id: bump-version
run: |
yarn release:version --release-type ${{ inputs.release-type || 'prerelease' }} ${{ inputs.pre-id && format('{0} {1}', '--pre-id', inputs.pre-id) || '' }} --verbose
yarn release:version --deferred --release-type ${{ inputs.release-type || 'prerelease' }} ${{ inputs.pre-id && format('{0} {1}', '--pre-id', inputs.pre-id) || '' }} --verbose
- name: Write changelog
env:
Expand All @@ -125,7 +125,7 @@ jobs:
git config --global user.email '[email protected]'
git checkout -b version-prerelease-from-${{ steps.bump-version.outputs.current-version }}
git add .
git commit -m "Bump version from ${{ steps.bump-version.outputs.current-version }} to ${{ steps.bump-version.outputs.next-version }}" || true
git commit -m "Write changelog for ${{ steps.bump-version.outputs.next-version }}" || true
git push --force origin version-prerelease-from-${{ steps.bump-version.outputs.current-version }}
- name: Generate PR description
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ jobs:
run: |
yarn install
- name: Apply deferred version bump and commit
id: version-bump
working-directory: .
run: |
CURRENT_VERSION=$(cat ./code/package.json | jq '.version')
DEFERRED_NEXT_VERSION=$(cat ./code/package.json | jq '.deferredNextVersion')
if [[ "$DEFERRED_NEXT_VERSION" == "null" ]]; then
echo "No deferred version set, not bumping versions"
exit 0
fi
cd scripts
yarn release:version --apply --verbose
cd ..
git config --global user.name "storybook-bot"
git config --global user.email "[email protected]"
git add .
git commit -m "Bump version from $CURRENT_VERSION to $DEFERRED_NEXT_VERSION" || true
git push origin ${{ github.ref_name }}
- name: Get current version
id: version
run: yarn release:get-current-version
Expand Down
52 changes: 30 additions & 22 deletions CONTRIBUTING/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The high-level flow is:

1. When a PR is merged to `next` (or a commit is pushed), both release pull requests are (re)generated.
2. They create a new branch - `version-(patch|prerelease)-from-<CURRENT-VERSION>`.
3. They bump all versions according to the version strategy.
3. They calculate which version to bump to according to the version strategy.
4. They update `CHANGELOG(.prerelease).md` with all changes detected.
5. They commit everything.
6. They **force push**.
Expand All @@ -112,7 +112,7 @@ A few key points to note in this flow:

- The PRs are regenerated on any changes to `next`, or can be manually triggered (see [the Re-trigger the Workflow section](#4-re-trigger-the-workflow)).
- The changes are force pushed to the branch, so any manual changes on the release branch before merging risk being overwritten if someone else merges a new change to `next`, triggering the workflow. To avoid this, apply the **"freeze"** label to the pull request.
- The version bumps and changelogs are committed during the preparation, but the packages are not published until later.
- The changelogs are committed during the preparation, but the packages are not version bumped and not published until later.
- The release pull requests don't target their working branches (`next` and `main`), but rather `next-release` and `latest-release`.

### Prereleases
Expand Down Expand Up @@ -149,9 +149,10 @@ gitGraph
checkout next
merge some-bugfix type: HIGHLIGHT
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
commit id: "write changelog"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.28 tag: "7.1.0-alpha.29"
merge version-prerelease-from-7.1.0-alpha.28
commit id: "bump versions" tag: "7.1.0-alpha.29"
checkout next
merge next-release
```
Expand Down Expand Up @@ -199,9 +200,10 @@ gitGraph
branch version-patch-from-7.0.18
cherry-pick id: "patch1"
cherry-pick id: "patch2"
commit id: "version bump"
commit id: "write changelog"
checkout latest-release
merge version-patch-from-7.0.18 tag: "v7.0.19"
merge version-patch-from-7.0.18
commit id: "bump versions" tag: "v7.0.19"
checkout main
merge latest-release
```
Expand All @@ -213,13 +215,14 @@ gitGraph
When either a prerelease or a patch release branch is merged into `main` or `next-release`, the publishing workflow is triggered. This workflow performs the following tasks:

1. Install dependencies and build all packages.
2. Publish packages to npm.
3. (If this is a patch release, add the "**picked**" label to all relevant pull requests.)
4. Create a new GitHub Release, including a version tag in the release branch (`latest-release` or `next-release`).
5. Merge the release branch into the core branch (`main` or `next`).
6. (If this is a patch release, copy the `CHANGELOG.md` changes from `main` to `next`.)
7. (If this is [a promotion from a prerelease to a stable release](#minormajor-releases---710-rc2---710-or-800-rc3---800), force push `next` to `main`.)
1. Bump versions of all packages according to the plan from the prepared PRs
2. Install dependencies and build all packages.
3. Publish packages to npm.
4. (If this is a patch release, add the "**picked**" label to all relevant pull requests.)
5. Create a new GitHub Release, including a version tag in the release branch (`latest-release` or `next-release`).
6. Merge the release branch into the core branch (`main` or `next`).
7. (If this is a patch release, copy the `CHANGELOG.md` changes from `main` to `next`.)
8. (If this is [a promotion from a prerelease to a stable release](#minormajor-releases---710-rc2---710-or-800-rc3---800), force push `next` to `main`.)

The publish workflow runs in the "release" GitHub environment, which has the npm token required to publish packages to the `@storybook` npm organization. For security reasons, this environment can only be accessed from the four "core" branches: `main`, `next`, `latest-release` and `next-release`.

Expand Down Expand Up @@ -318,7 +321,7 @@ When the pull request was frozen, a CI run was triggered on the branch. If it's

### 7. See the "Publish" Workflow Finish

Merging the pull request will trigger [the publish workflow](https://github.com/storybookjs/storybook/actions/workflows/publish.yml), which does the final publishing. As a Releaser, you're responsible for this to finish successfully, so you should watch it until the end. If it fails, it will notify in Discord, so you can monitor that instead if you want to.
Merging the pull request will trigger [the publish workflow](https://github.com/storybookjs/storybook/actions/workflows/publish.yml), which does the final version bumping and publishing. As a Releaser, you're responsible for this to finish successfully, so you should watch it until the end. If it fails, it will notify in Discord, so you can monitor that instead if you want to.

Done! 🚀

Expand All @@ -339,15 +342,18 @@ Before you start you should make sure that your working tree is clean and the re
5. (If patch release) Cherry pick:
1. `yarn release:pick-patches`
2. Manually cherry pick any necessary patches based on the previous output
6. Bump versions: `yarn release:version --verbose --release-type <RELEASE_TYPE> --pre-id <PRE_ID>`
6. Bump versions:
1. If you plan on using automatic publishing (ie. stop at step 12), bump with deferred: `yarn release:version --verbose --deferred --release-type <RELEASE_TYPE> --pre-id <PRE_ID>`
2. If doing the whole release locally, **do not** defer the bump: `yarn release:version --verbose --release-type <RELEASE_TYPE> --pre-id <PRE_ID>`
7. To see a list of changes (for your own to-do list), run `yarn release:generate-pr-description --current-version <CURRENT_VERSION> --next-version <NEXT_VERSION_FROM_PREVIOUS_STEP> --verbose`
8. Write changelogs: `yarn release:write-changelog <NEXT_VERSION_FROM_PREVIOUS_STEP> --verbose`
9. `git add .`.
10. Commit changes: `git commit -m "Bump version from <CURRENT_VERSION> to <NEXT_VERSION_FROM_PREVIOUS_STEP> MANUALLY"`
11. Merge changes to the release branch:
1. `git checkout <"latest-release" | "next-release">`
2. `git merge <PREVIOUS_BRANCH>`
3. `git push origin`
2. `git pull`
3. `git merge <PREVIOUS_BRANCH>`
4. `git push origin`
12. (If automatic publishing is still working, it should kick in now and the rest of the steps can be skipped)
13. `cd ..`
14. Publish to the registry: `YARN_NPM_AUTH_TOKEN=<NPM_TOKEN> yarn release:publish --tag <"next" OR "latest"> --verbose`
Expand Down Expand Up @@ -508,7 +514,7 @@ gitGraph
commit
checkout next
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
commit id
checkout next
merge some-simultaneous-bugfix type: HIGHLIGHT id: "whoops!"
merge version-prerelease-from-7.1.0-alpha.28 tag: "v7.1.0-alpha.29"
Expand All @@ -532,17 +538,19 @@ gitGraph
commit
checkout next
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
commit id: "write changelog"
checkout next
merge some-simultanous-bugfix id: "whoops!"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.28 tag: "v7.1.0-alpha.29"
merge version-prerelease-from-7.1.0-alpha.28
commit id: "bump versions" tag: "v7.1.0-alpha.29"
checkout next
merge next-release
branch version-prerelease-from-7.1.0-alpha.29
commit id: "bump version again"
commit id: "write changelog again"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.29 tag: "v7.1.0-alpha.30"
merge version-prerelease-from-7.1.0-alpha.29
commit id: "bump versions again" tag: "v7.1.0-alpha.30"
checkout next
merge next-release
```
Expand Down
4 changes: 4 additions & 0 deletions code/__mocks__/fs-extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const readJsonSync = (filePath = '') => JSON.parse(mockFiles[filePath]);
const lstatSync = (filePath) => ({
isFile: () => !!mockFiles[filePath],
});
const writeJson = jest.fn((filePath, json, { spaces } = {}) => {
mockFiles[filePath] = JSON.stringify(json, null, spaces);
});

// eslint-disable-next-line no-underscore-dangle
fs.__setMockFiles = __setMockFiles;
Expand All @@ -29,5 +32,6 @@ fs.readJson = readJson;
fs.readJsonSync = readJsonSync;
fs.existsSync = existsSync;
fs.lstatSync = lstatSync;
fs.writeJson = writeJson;

module.exports = fs;
2 changes: 1 addition & 1 deletion code/frameworks/svelte-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@storybook/builder-vite": "7.1.0-rc.1",
"@storybook/node-logger": "7.1.0-rc.1",
"@storybook/svelte": "7.1.0-rc.1",
"@sveltejs/vite-plugin-svelte": "^2.4.1",
"@sveltejs/vite-plugin-svelte": "^2.4.2",
"magic-string": "^0.30.0",
"sveltedoc-parser": "^4.2.1",
"ts-dedent": "^2.2.0"
Expand Down
28 changes: 14 additions & 14 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7374,7 +7374,7 @@ __metadata:
"@storybook/builder-vite": 7.1.0-rc.1
"@storybook/node-logger": 7.1.0-rc.1
"@storybook/svelte": 7.1.0-rc.1
"@sveltejs/vite-plugin-svelte": ^2.4.1
"@sveltejs/vite-plugin-svelte": ^2.4.2
"@types/node": ^16.0.0
magic-string: ^0.30.0
svelte: ^4.0.0
Expand Down Expand Up @@ -7720,34 +7720,34 @@ __metadata:
languageName: node
linkType: hard

"@sveltejs/vite-plugin-svelte-inspector@npm:^1.0.2":
version: 1.0.2
resolution: "@sveltejs/vite-plugin-svelte-inspector@npm:1.0.2"
"@sveltejs/vite-plugin-svelte-inspector@npm:^1.0.3":
version: 1.0.3
resolution: "@sveltejs/vite-plugin-svelte-inspector@npm:1.0.3"
dependencies:
debug: ^4.3.4
peerDependencies:
"@sveltejs/vite-plugin-svelte": ^2.2.0
svelte: ^3.54.0 || ^4.0.0-next.0
svelte: ^3.54.0 || ^4.0.0
vite: ^4.0.0
checksum: b94d8e6f9fcca6ff5a3c1a07c6bcc3e952410845adbd8f69ec0afc9b7b8c1823b20d92cc90ce00cf38c69d1b5bcbe2a05a54941e30d171b8b3df5ea9782b1c32
checksum: a64f9a8742cde3f601f6480b56128df8cab553043deab1f96884e34f153ca5020233348ce7ba624900d26b0da4324fef82f4b6a3deec33f9eca7f5938c33c1d7
languageName: node
linkType: hard

"@sveltejs/vite-plugin-svelte@npm:^2.4.1":
version: 2.4.1
resolution: "@sveltejs/vite-plugin-svelte@npm:2.4.1"
"@sveltejs/vite-plugin-svelte@npm:^2.4.2":
version: 2.4.2
resolution: "@sveltejs/vite-plugin-svelte@npm:2.4.2"
dependencies:
"@sveltejs/vite-plugin-svelte-inspector": ^1.0.2
"@sveltejs/vite-plugin-svelte-inspector": ^1.0.3
debug: ^4.3.4
deepmerge: ^4.3.1
kleur: ^4.1.5
magic-string: ^0.30.0
svelte-hmr: ^0.15.1
svelte-hmr: ^0.15.2
vitefu: ^0.2.4
peerDependencies:
svelte: ^3.54.0 || ^4.0.0-next.0
svelte: ^3.54.0 || ^4.0.0
vite: ^4.0.0
checksum: c5799b9cef9725ca906f8e21f042ac9e5a7023596442eb2fa82b4c9169fa999e2a16b3ef096e8439d09b22acd253ffcbc30a38823807705f213683cf0c771b96
checksum: 303401055cb4f31407a51e8adaabf9a68dbc9977fa1cf0a9353baadecd4fd0d67ccfc881e29160907d6a3a738a25e6feab9dd638099ff4ced4909f612616850b
languageName: node
linkType: hard

Expand Down Expand Up @@ -28736,7 +28736,7 @@ __metadata:
languageName: node
linkType: hard

"svelte-hmr@npm:^0.15.1":
"svelte-hmr@npm:^0.15.2":
version: 0.15.2
resolution: "svelte-hmr@npm:0.15.2"
peerDependencies:
Expand Down
Loading

0 comments on commit b55179f

Please sign in to comment.