You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/PULL_REQUEST_TEMPLATE.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,3 +37,13 @@ Closes #
37
37
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
38
38
39
39
-->
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>`_
# 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
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.
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 }}"
Copy file name to clipboardExpand all lines: CONTRIBUTING/RELEASING.md
+46-1Lines changed: 46 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -385,7 +385,52 @@ Before you start you should make sure that your working tree is clean and the re
385
385
386
386
## Canary Releases
387
387
388
-
Not implemented yet. Still work in progress, stay tuned.
388
+
It's possible to release any pull request as a canary release multiple times during development. This is an effective way to try out changes in standalone projects without linking projects together via package managers.
389
+
390
+
To create a canary release, a core team member (or anyone else with administrator privileges) must manually trigger the canary release workflow.
391
+
392
+
**Before creating a canary release from contributors, the core team member must ensure that the code being released is not malicious.**
393
+
394
+
Creating a canary release can either be done via GitHub's UI or the [CLI](https://cli.github.com/):
395
+
396
+
### With GitHub UI
397
+
398
+
1. Open the workflow UI at https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml
399
+
2. On the top right corner, click "Run workflow"
400
+
3. For "branch", **always select `next`**, regardless of which branch your pull request is on
401
+
4. For the pull request number, input the number for the pull request **without a leading #**
402
+
403
+
### With the CLI
404
+
405
+
The following command will trigger a workflow run - replace `<PR_NUMBER>` with the actual pull request number:
406
+
407
+
```bash
408
+
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
409
+
```
410
+
411
+
When the release succeeds, it will update the "Canary release" section of the pull request with information about the release and how to use it (see example [here](https://github.com/storybookjs/storybook/pull/23508)). If it fails, it will create a comment on the pull request, tagging the triggering actor to let them know that it failed (see example [here](https://github.com/storybookjs/storybook/pull/23508#issuecomment-1642850467)).
412
+
413
+
The canary release will have the following version format: `<CURRENT_VERSION>-canary-<PR_NUMBER>-<TIMESTAMP>-<COMMIT_SHA>.0`, e.g., `7.1.1-canary-23508-1689802571-5ec8c1c3.0`.
414
+
415
+
- The current version has no actual meaning but softly indicates which version the pull request is based on (e.g., a pull request based on v7.1.0 will get released as a canary version of v7.1.1).
416
+
- The timestamp ensures that any subsequent releases are always considered newer.
417
+
- The commit hash indicates which exact code has been released.
418
+
419
+
> ** Note **
420
+
> All canary releases are released under the same "canary" dist tag. This means you'll technically be able to install it with `npm install @storybook/cli@canary`. However, this doesn't make sense, as releases from subsequent pull requests will overwrite that tag quickly. Therefore you should always install the specific version string, e.g., `npm install @storybook/cli@7.1.1-canary-23508-1689802571-5ec8c1c3.0.
421
+
422
+
<details>
423
+
<summary>Isn't there a simpler/smarter way to do this?</summary>
424
+
425
+
The simple approach would be to release canaries for all pull requests automatically; however, this would be insecure as any contributor with Write privileges to the repository (200+ users) could create a malicious pull request that alters the release script to release a malicious release (e.g., release a patch version that adds a crypto miner).
426
+
427
+
To alleviate this, we only allow the "Release" GitHub environment that contains the npm token to be accessible from workflows running on the protected branches (`next`, `main`, etc.).
428
+
429
+
You could also be tempted to require approval from admins before running the workflows. However, this would spam the core team with GitHub notifications for workflow runs seeking approval - even when a core team member triggered the workflow. Therefore we are doing it the other way around, requiring contributors and maintainers to ask for a canary release to be created explicitly.
430
+
431
+
Instead of triggering the workflow manually, you could also do something smart, like trigger it when there's a specific label on the pull request or when someone writes a specific comment on the pull request. However, this would create a lot of unnecessary workflow runs because there isn't a way to filter workflow runs based on labels or comment content. The only way to achieve this would be to trigger the workflow on every comment/labeling, then cancel it if it didn't contain the expected content, which is inefficient.
0 commit comments