Skip to content

Commit c6a446f

Browse files
committed
Merge branch 'next' into valentin/nextjs-fix-yarn-pnp-issue
2 parents 5d0d95c + 2050097 commit c6a446f

File tree

186 files changed

+2853
-1812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+2853
-1812
lines changed

.circleci/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ jobs:
459459
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
460460

461461
workflows:
462+
docs:
463+
when:
464+
equal: [docs, << pipeline.parameters.workflow >>]
465+
jobs:
466+
- pretty-docs
462467
normal:
463468
when:
464469
equal: [normal, << pipeline.parameters.workflow >>]

.github/PULL_REQUEST_TEMPLATE.md

+10
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ Closes #
3737
Everybody: Please submit all PRs to the `next` branch unless they are specific to the current release. Storybook maintainers cherry-pick bug and documentation fixes into the `main` branch as part of the release process, so you shouldn't need to worry about this. For additional guidance: https://storybook.js.org/docs/react/contribute/how-to-contribute
3838
3939
-->
40+
41+
### 🦋 Canary release
42+
43+
<!-- CANARY_RELEASE_SECTION -->
44+
45+
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the `@storybookjs/core` team here.
46+
47+
_core team members can create a canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) or locally with `gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>`_
48+
49+
<!-- CANARY_RELEASE_SECTION -->

.github/workflows/canary-release-pr.yml

+98-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
inputs:
77
pr:
8-
description: 'Which pull request number to create a canary release for'
8+
description: 'Pull request number to create a canary release for'
99
required: true
1010
type: number
1111

@@ -14,7 +14,7 @@ env:
1414
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
1515

1616
concurrency:
17-
group: ${{ github.workflow }}-${{ inputs.pr }}
17+
group: ${{ github.workflow }}-${{ github.event.inputs.pr }}
1818
cancel-in-progress: true
1919

2020
permissions:
@@ -25,9 +25,100 @@ jobs:
2525
name: Release canary version
2626
runs-on: ubuntu-latest
2727
environment: release
28-
defaults:
29-
run:
30-
working-directory: scripts
3128
steps:
32-
- name: Do nothing
33-
run: echo "I'm not doing anything"
29+
- name: Fail if triggering actor is not administrator
30+
uses: prince-chrismc/[email protected]
31+
with:
32+
permission: admin
33+
34+
- name: Get pull request information
35+
id: info
36+
env:
37+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
38+
run: |
39+
PR_INFO=$(gh pr view ${{ inputs.pr }} --repo ${{ github.repository }} --json isCrossRepository,headRefOid,headRefName,headRepository,headRepositoryOwner --jq '{isFork: .isCrossRepository, owner: .headRepositoryOwner.login, repoName: .headRepository.name, branch: .headRefName, sha: .headRefOid}')
40+
echo $PR_INFO
41+
# Loop through each key-value pair in PR_INFO and set as step output
42+
for key in $(echo "$PR_INFO" | jq -r 'keys[]'); do
43+
value=$(echo "$PR_INFO" | jq -r ".$key")
44+
echo "$key=$value" >> "$GITHUB_OUTPUT"
45+
done
46+
echo "repository=$(echo "$PR_INFO" | jq -r ".owner")/$(echo "$PR_INFO" | jq -r ".repoName")" >> $GITHUB_OUTPUT
47+
echo "shortSha=$(echo "$PR_INFO" | jq -r ".sha" | cut -c 1-8)" >> $GITHUB_OUTPUT
48+
echo "date=$(date)" >> $GITHUB_OUTPUT
49+
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
50+
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
with:
54+
repository: ${{ steps.info.outputs.isFork == 'true' && steps.info.outputs.repository || null }}
55+
ref: ${{ steps.info.outputs.sha }}
56+
token: ${{ secrets.GH_TOKEN }}
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v3
60+
with:
61+
node-version: '16'
62+
63+
- name: Cache dependencies
64+
uses: actions/cache@v3
65+
with:
66+
path: |
67+
~/.yarn/berry/cache
68+
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
69+
restore-keys: |
70+
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
71+
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
72+
yarn-v1
73+
74+
- name: Install dependencies
75+
run: yarn task --task=install --start-from=install
76+
77+
- name: Set version
78+
id: version
79+
working-directory: scripts
80+
run: |
81+
yarn release:version --release-type prerelease --pre-id canary-${{ inputs.pr }}-${{ steps.info.outputs.timestamp }}-${{ steps.info.outputs.shortSha }} --verbose
82+
83+
- name: Publish v${{ steps.version.outputs.next-version }}
84+
env:
85+
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
86+
working-directory: scripts
87+
run: yarn release:publish --tag canary --verbose
88+
89+
- name: Replace Pull Request Body
90+
# TODO: replace with ivangabriele/find-and-replace-pull-request-body@vX when https://github.com/ivangabriele/find-and-replace-pull-request-body/pull/11 has been released
91+
uses: mcky/[email protected]
92+
with:
93+
githubToken: ${{ secrets.GH_TOKEN }}
94+
prNumber: ${{ inputs.pr }}
95+
find: 'CANARY_RELEASE_SECTION'
96+
isHtmlCommentTag: true
97+
replace: |
98+
This pull request has been released as version [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }}). Install it by pinning all your Storybook dependencies to that version.
99+
<details>
100+
<summary>More information</summary>
101+
102+
| | |
103+
| --- | --- |
104+
| **Published version** | [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }}) |
105+
| **Triggered by** | @${{ github.triggering_actor }} |
106+
| **Repository** | [${{ steps.info.outputs.repository }}](https://github.com/${{ steps.info.outputs.repository }}) |
107+
| **Branch** | [`${{ steps.info.outputs.branch }}`](https://github.com/${{ steps.info.outputs.repository }}/tree/${{ steps.info.outputs.branch }}) |
108+
| **Commit** | [`${{ steps.info.outputs.shortSha }}`](https://github.com/${{ steps.info.outputs.repository }}/commit/${{ steps.info.outputs.sha }}) |
109+
| **Datetime** | ${{ steps.info.outputs.date }} (`${{ steps.info.outputs.timestamp }}`) |
110+
| **Workflow run** | [${{ github.run_id }}](https://github.com/storybookjs/storybook/actions/runs/${{ github.run_id }}) |
111+
112+
To request a new release of this pull request, mention the `@storybookjs/core` team.
113+
114+
_core team members can create a new canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) or locally with `gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=${{ inputs.pr }}`_
115+
</details>
116+
117+
- name: Create failing comment on PR
118+
if: failure()
119+
env:
120+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
121+
run: |
122+
gh pr comment ${{ inputs.pr }}\
123+
--repo "${{github.repository }}"\
124+
--body "Failed to publish canary version of this pull request, triggered by @${{ github.triggering_actor }}. See the failed workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

.github/workflows/publish.yml

+30-10
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ jobs:
121121
if: github.ref_name == 'latest-release'
122122
run: git fetch --tags origin
123123

124+
# when this is a patch release from main, label any patch PRs included in the release
125+
# when this is a stable release from next, label ALL patch PRs found, as they will per definition be "patched" now
124126
- name: Label patch PRs as picked
125-
if: github.ref_name == 'latest-release'
127+
if: github.ref_name == 'latest-release' || (steps.publish-needed.outputs.published == 'false' && steps.target.outputs.target == 'next' && !steps.is-prerelease.outputs.prerelease)
126128
env:
127129
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128-
run: yarn release:label-patches
130+
run: yarn release:label-patches ${{ steps.target.outputs.target == 'next' && '--all' || '' }}
129131

130132
- name: Create GitHub Release
131133
if: steps.publish-needed.outputs.published == 'false'
@@ -161,25 +163,43 @@ jobs:
161163
git commit -m "Update CHANGELOG.md for v${{ steps.version.outputs.current-version }} [skip ci]"
162164
git push origin next
163165
164-
- name: Sync versions/next.json from `next` to `main`
166+
- name: Sync version JSONs from `next-release` to `main`
165167
if: github.ref_name == 'next-release'
166168
working-directory: .
167169
run: |
170+
VERSION_FILE="./docs/versions/${{ steps.is-prerelease.outputs.prerelease == 'true' && 'next' || 'latest' }}.json"
168171
git fetch origin main
169172
git checkout main
170173
git pull
171-
git checkout origin/next ./docs/versions/next.json
172-
git add ./docs/versions/next.json
173-
git commit -m "Update versions/next.json for v${{ steps.version.outputs.current-version }}"
174+
git checkout origin/next-release $VERSION_FILE
175+
git add $VERSION_FILE
176+
git commit -m "Update $VERSION_FILE for v${{ steps.version.outputs.current-version }}"
174177
git push origin main
175178
176-
# Force push from next to main if it is not a prerelease, and this release is from next-release
179+
# TODO: this is currently disabled, because we may have a better strategy that we want to try out manually first before comitting to it:
180+
# - create a branch "release-<VERSION>" from HEAD of main
181+
# - git push --force origin ${{ steps.target.outputs.target }}:main
182+
# - ... this will keep the "main" history in the new release branch, and then overwrite main's history with next's
183+
184+
# Sync next-release to main if it is not a prerelease, and this release is from next-release
177185
# This happens when eg. next has been tracking 7.1.0-alpha.X, and now we want to release 7.1.0
178-
# This will keep release-next, next and main all tracking v7.1.0
179-
# - name: Force push ${{ steps.target.outputs.target }} to main
186+
# This will keep next-release, next and main all tracking v7.1.0
187+
# See "Alternative merge strategies" in https://stackoverflow.com/a/36321787
188+
# - name: Sync next-release to main
180189
# if: steps.publish-needed.outputs.published == 'false' && steps.target.outputs.target == 'next' && !steps.is-prerelease.outputs.prerelease
190+
# working-directory: .
181191
# run: |
182-
# git push --force origin ${{ steps.target.outputs.target }}:main
192+
# git fetch origin next-release
193+
# git checkout next-release
194+
# git pull
195+
# git fetch origin main
196+
# git checkout main
197+
# git pull
198+
# git merge --no-commit -s ours next-release
199+
# git rm -rf .
200+
# git checkout next-release -- .
201+
# git commit -m "Sync next-release to main"
202+
# git push origin main
183203

184204
- name: Report job failure to Discord
185205
if: failure()

.github/workflows/trigger-circle-ci-workflow.yml

+19
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ jobs:
5555
env:
5656
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
5757
BRANCH: ${{ needs.get-branch.outputs.branch }}
58+
trigger-docs-tests:
59+
runs-on: ubuntu-latest
60+
needs: get-branch
61+
if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'ci:docs')
62+
steps:
63+
- name: Trigger docs tests
64+
run: >
65+
curl -X POST --location "https://circleci.com/api/v2/project/gh/storybookjs/storybook/pipeline" \
66+
-H "Content-Type: application/json" \
67+
-H "Circle-Token: $CIRCLE_CI_TOKEN" \
68+
-d '{
69+
"branch": "'"$BRANCH"'",
70+
"parameters": {
71+
"workflow": "docs"
72+
}
73+
}'
74+
env:
75+
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
76+
BRANCH: ${{ needs.get-branch.outputs.branch }}
5877
trigger-merged-tests:
5978
runs-on: ubuntu-latest
6079
needs: get-branch

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 7.1.1
2+
3+
- Angular: Make enableProdMode optional - [#23489](https://github.com/storybookjs/storybook/pull/23489), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
4+
- CLI: Gracefully shutdown and cleanup execa child processes - [#23538](https://github.com/storybookjs/storybook/pull/23538), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
5+
- CLI: Improve support of mono repositories - [#23458](https://github.com/storybookjs/storybook/pull/23458), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
6+
17
## 7.1.0 (July 18, 2023)
28

39
Storybook 7.1 is here! 🎉

0 commit comments

Comments
 (0)