-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into valentin/nextjs-fix-yarn-pnp-issue
- Loading branch information
Showing
186 changed files
with
2,853 additions
and
1,812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
workflow_dispatch: | ||
inputs: | ||
pr: | ||
description: 'Which pull request number to create a canary release for' | ||
description: 'Pull request number to create a canary release for' | ||
required: true | ||
type: number | ||
|
||
|
@@ -14,7 +14,7 @@ env: | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ inputs.pr }} | ||
group: ${{ github.workflow }}-${{ github.event.inputs.pr }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
|
@@ -25,9 +25,100 @@ jobs: | |
name: Release canary version | ||
runs-on: ubuntu-latest | ||
environment: release | ||
defaults: | ||
run: | ||
working-directory: scripts | ||
steps: | ||
- name: Do nothing | ||
run: echo "I'm not doing anything" | ||
- name: Fail if triggering actor is not administrator | ||
uses: prince-chrismc/[email protected] | ||
with: | ||
permission: admin | ||
|
||
- name: Get pull request information | ||
id: info | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: | | ||
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}') | ||
echo $PR_INFO | ||
# Loop through each key-value pair in PR_INFO and set as step output | ||
for key in $(echo "$PR_INFO" | jq -r 'keys[]'); do | ||
value=$(echo "$PR_INFO" | jq -r ".$key") | ||
echo "$key=$value" >> "$GITHUB_OUTPUT" | ||
done | ||
echo "repository=$(echo "$PR_INFO" | jq -r ".owner")/$(echo "$PR_INFO" | jq -r ".repoName")" >> $GITHUB_OUTPUT | ||
echo "shortSha=$(echo "$PR_INFO" | jq -r ".sha" | cut -c 1-8)" >> $GITHUB_OUTPUT | ||
echo "date=$(date)" >> $GITHUB_OUTPUT | ||
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ steps.info.outputs.isFork == 'true' && steps.info.outputs.repository || null }} | ||
ref: ${{ steps.info.outputs.sha }} | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.yarn/berry/cache | ||
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }} | ||
restore-keys: | | ||
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }} | ||
yarn-v1-${{ hashFiles('scripts/yarn.lock') }} | ||
yarn-v1 | ||
- name: Install dependencies | ||
run: yarn task --task=install --start-from=install | ||
|
||
- name: Set version | ||
id: version | ||
working-directory: scripts | ||
run: | | ||
yarn release:version --release-type prerelease --pre-id canary-${{ inputs.pr }}-${{ steps.info.outputs.timestamp }}-${{ steps.info.outputs.shortSha }} --verbose | ||
- name: Publish v${{ steps.version.outputs.next-version }} | ||
env: | ||
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
working-directory: scripts | ||
run: yarn release:publish --tag canary --verbose | ||
|
||
- name: Replace Pull Request Body | ||
# 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 | ||
uses: mcky/[email protected] | ||
with: | ||
githubToken: ${{ secrets.GH_TOKEN }} | ||
prNumber: ${{ inputs.pr }} | ||
find: 'CANARY_RELEASE_SECTION' | ||
isHtmlCommentTag: true | ||
replace: | | ||
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. | ||
<details> | ||
<summary>More information</summary> | ||
| | | | ||
| --- | --- | | ||
| **Published version** | [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }}) | | ||
| **Triggered by** | @${{ github.triggering_actor }} | | ||
| **Repository** | [${{ steps.info.outputs.repository }}](https://github.com/${{ steps.info.outputs.repository }}) | | ||
| **Branch** | [`${{ steps.info.outputs.branch }}`](https://github.com/${{ steps.info.outputs.repository }}/tree/${{ steps.info.outputs.branch }}) | | ||
| **Commit** | [`${{ steps.info.outputs.shortSha }}`](https://github.com/${{ steps.info.outputs.repository }}/commit/${{ steps.info.outputs.sha }}) | | ||
| **Datetime** | ${{ steps.info.outputs.date }} (`${{ steps.info.outputs.timestamp }}`) | | ||
| **Workflow run** | [${{ github.run_id }}](https://github.com/storybookjs/storybook/actions/runs/${{ github.run_id }}) | | ||
To request a new release of this pull request, mention the `@storybookjs/core` team. | ||
_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 }}`_ | ||
</details> | ||
- name: Create failing comment on PR | ||
if: failure() | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: | | ||
gh pr comment ${{ inputs.pr }}\ | ||
--repo "${{github.repository }}"\ | ||
--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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.