Skip to content

Commit

Permalink
Merge pull request #23012 from storybookjs/version-patch-from-7.0.20
Browse files Browse the repository at this point in the history
Release: Patch 7.0.21
  • Loading branch information
kasperpeulen authored Jun 15, 2023
2 parents 8b19135 + 9daeda4 commit 9a57248
Show file tree
Hide file tree
Showing 241 changed files with 7,513 additions and 1,984 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ executors:
default: 'small'
working_directory: /tmp/storybook
docker:
- image: mcr.microsoft.com/playwright:v1.32.3-focal
- image: mcr.microsoft.com/playwright:v1.35.0-focal
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/canary-release-pr.WIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish canary release of PR
run-name: 'Canary release: PR #${{ github.event.pull_request.number }} at ${{ github.sha }}'

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- next

env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
pull-requests: write

jobs:
release-canary:
name: Release canary version
runs-on: ubuntu-latest
environment: canary-release
defaults:
run:
working-directory: scripts
steps:
- name: Checkout
uses: actions/checkout@v3

- 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
working-directory: .
run: yarn task --task=install --start-from=install

- name: Set version
id: version
run: |
SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
yarn release:version --release-type prerelease --pre-id pr-${{ github.event.pull_request.number }}-$SHORT_SHA --verbose

- name: Publish v${{ steps.version.outputs.next-version }}
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release:publish --tag pr-${{ github.event.pull_request.number }} --verbose

- name: Create comment on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }}\
--repo "${{github.repository }}"\
--body "🚀 This pull request has been published as version \`${{ steps.version.outputs.next-version }}\` and with the tag \`pr-${{ github.event.pull_request.number }}\`.
[You can see it on the npm registry here](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }})".

- name: Create failing comment on PR
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }}\
--repo "${{github.repository }}"\
--body "Failed to publish canary version of this pul request. See the failed workflow run at See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

# - name: Report failure to Discord
# if: failure()
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
# uses: Ilshidur/action-discord@master
# with:
# args: 'The GitHub Action for publishing version ${{ steps.version.outputs.current-version }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
19 changes: 19 additions & 0 deletions .github/workflows/check-release-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check release tasks
run-name: 'Check tasks for "${{ github.event.pull_request.title }}" PR'

on:
pull_request:
types:
- opened
- edited
branches:
- 'latest-release'
- 'next-release'

jobs:
task-check:
runs-on: ubuntu-latest
steps:
- uses: chromaui/task-completed-checker-action@main
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
4 changes: 2 additions & 2 deletions .github/workflows/danger-js.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
types: [opened, synchronize, reopened, labeled, unlabeled, edited]

name: Danger JS
jobs:
Expand All @@ -13,7 +13,7 @@ jobs:
node-version: '16'
- uses: actions/checkout@v3
- name: Danger JS
uses: danger/danger-js@10.9.0
uses: danger/danger-js@11.2.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
175 changes: 175 additions & 0 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: Prepare patch PR
run-name: Prepare patch PR, triggered by ${{ github.triggering_actor }}

on:
push:
branches:
- next
workflow_dispatch:

env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
prepare-patch-pull-request:
name: Prepare patch pull request
runs-on: ubuntu-latest
defaults:
run:
working-directory: scripts
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main

- 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
working-directory: .
run: |
yarn task --task=install
- name: Check if pull request is frozen
if: github.event_name != 'workflow_dispatch'
id: check-frozen
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:is-pr-frozen

- name: Cancel when frozen
if: steps.check-frozen.outputs.frozen == 'true' && github.event_name != 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# From https://stackoverflow.com/a/75809743
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Check for unreleased changes
id: unreleased-changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:unreleased-changes-exists --unpicked-patches

- name: Fetch next branch
run:
# depth needs to be set to a high enough number that it will contain all the merge commits to cherry-pick
# as of May 2023, the whole repo had 55K commits
git fetch --depth=2000 origin next

- name: Pick patches
id: pick-patches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
yarn release:pick-patches
- name: Bump version
id: bump-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
run: |
yarn release:version --release-type patch --verbose
# We need the current version to set the branch name, even when not bumping the version
- name: Get current version
id: current-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'false'
run: |
yarn release:get-current-version --verbose
- name: Set version output
id: versions
run: |
echo "current=${{ steps.bump-version.outputs.current-version || steps.current-version.outputs.current-version }}" >> "$GITHUB_OUTPUT"
echo "next=${{ steps.bump-version.outputs.next-version || steps.current-version.outputs.current-version }}" >> "$GITHUB_OUTPUT"
- name: Write changelog
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn release:write-changelog ${{ steps.versions.outputs.next }} --unpicked-patches --verbose
- name: 'Commit changes to branch: version-patch-from-${{ steps.versions.outputs.current }}'
working-directory: .
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
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 push --force origin version-patch-from-${{ steps.versions.outputs.current }}
- name: Generate PR description
id: description
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:generate-pr-description --unpicked-patches --manual-cherry-picks='${{ steps.pick-patches.outputs.failed-cherry-picks }}' ${{ steps.unreleased-changes.outputs.has-changes-to-release == 'true' && format('{0}={1} {2}={3}', '--current-version', steps.versions.outputs.current, '--next-version', steps.versions.outputs.next) || '' }} --verbose

- name: Create or update pull request with release
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if PR_STATE=$(gh pr view --json state --jq .state 2>/dev/null) && [[ -n "$PR_STATE" && "$PR_STATE" == *"OPEN"* ]]; then
gh pr edit \
--repo "${{github.repository }}" \
--title "Bump version on \`main\`: patch from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.next }}" \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}" \
--title "Bump version on \`main\`: patch from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.next }}" \
--base latest-release \
--head version-patch-from-${{ steps.versions.outputs.current }} \
--body "${{ steps.description.outputs.description }}"
fi
- name: Create or update pull request without release
if: steps.unreleased-changes.outputs.has-changes-to-release == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if PR_STATE=$(gh pr view --json state --jq .state 2>/dev/null) && [[ -n "$PR_STATE" && "$PR_STATE" == *"OPEN"* ]]; then
gh pr edit \
--repo "${{github.repository }}"\
--title "Merge patches to \`main\`" \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}"\
--title "Merge patches to \`main\`" \
--base latest-release \
--head version-patch-from-${{ steps.versions.outputs.current }} \
--body "${{ steps.description.outputs.description }}"
fi
- name: Report job failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The GitHub Action for preparing the release pull request bumping from v${{ steps.versions.outputs.current }} to v${{ steps.versions.outputs.next }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Loading

0 comments on commit 9a57248

Please sign in to comment.