Skip to content

Commit

Permalink
Revert "Merge pull request #24106 from storybookjs/release-stable-to-…
Browse files Browse the repository at this point in the history
…latest"

This reverts commit 43825e0.
  • Loading branch information
JReinhold committed Oct 5, 2023
1 parent 43825e0 commit f73a915
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 648 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ jobs:
git config --global user.email '[email protected]'
yarn release:pick-patches
- name: Cancel when no patches to pick
if: steps.pick-patches.outputs.pr-count == '0' && steps.pick-patches.outputs.pr-count != null
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: Bump version deferred
id: bump-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
Expand Down Expand Up @@ -130,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 "Write changelog for ${{ steps.versions.outputs.next }} [skip ci]" || 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
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ concurrency:
cancel-in-progress: true

jobs:
prepare-non-patch-pull-request:
prepare-prerelease-pull-request:
name: Prepare prerelease pull request
runs-on: ubuntu-latest
environment: release
Expand Down Expand Up @@ -112,35 +112,21 @@ jobs:
run: |
yarn release:version --deferred --release-type ${{ inputs.release-type || 'prerelease' }} ${{ inputs.pre-id && format('{0} {1}', '--pre-id', inputs.pre-id) || '' }} --verbose
- name: Check release vs prerelease
id: is-prerelease
run: yarn release:is-prerelease ${{ steps.bump-version.outputs.next-version }}

- name: Write changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn release:write-changelog ${{ steps.bump-version.outputs.next-version }} --verbose
- name: 'Commit changes to branch: version-non-patch-from-${{ steps.bump-version.outputs.current-version }}'
- name: 'Commit changes to branch: version-prerelease-from-${{ steps.bump-version.outputs.current-version }}'
working-directory: .
run: |
git config --global user.name 'storybook-bot'
git config --global user.email '[email protected]'
git checkout -b version-non-patch-from-${{ steps.bump-version.outputs.current-version }}
git add .
git commit -m "Write changelog for ${{ steps.bump-version.outputs.next-version }} [skip ci]" || true
git push --force origin version-non-patch-from-${{ steps.bump-version.outputs.current-version }}
- name: Resolve merge-conflicts with base branch
if: steps.is-prerelease.outputs.prerelease == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git pull origin latest-release
git checkout --ours .
git checkout -b version-prerelease-from-${{ steps.bump-version.outputs.current-version }}
git add .
git commit -m "Merge latest-release into version-non-patch-from-${{ steps.bump-version.outputs.current-version }} with conflicts resolved to ours [skip ci]"
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
id: description
Expand All @@ -158,15 +144,14 @@ jobs:
gh pr edit \
--repo "${{github.repository }}" \
--title "Release: $CAPITALIZED_RELEASE_TYPE ${{ inputs.pre-id && format('{0} ', inputs.pre-id) }}${{ steps.bump-version.outputs.next-version }}" \
--base ${{ steps.is-prerelease.outputs.prerelease == 'true' && 'next-release' || 'latest-release' }} \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}"\
--title "Release: $CAPITALIZED_RELEASE_TYPE ${{ inputs.pre-id && format('{0} ', inputs.pre-id) }}${{ steps.bump-version.outputs.next-version }}" \
--label "release" \
--base ${{ steps.is-prerelease.outputs.prerelease == 'true' && 'next-release' || 'latest-release' }} \
--head version-non-patch-from-${{ steps.bump-version.outputs.current-version }} \
--base next-release \
--head version-prerelease-from-${{ steps.bump-version.outputs.current-version }} \
--body "${{ steps.description.outputs.description }}"
fi
Expand Down
33 changes: 11 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- latest-release
- non-patch-release
- next-release

env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
Expand Down Expand Up @@ -36,11 +36,6 @@ jobs:
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Cancel all release preparation runs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:cancel-preparation-runs

- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -68,6 +63,7 @@ jobs:
yarn install
- name: Apply deferred version bump and commit
id: version-bump
working-directory: .
run: |
CURRENT_VERSION=$(cat ./code/package.json | jq '.version')
Expand Down Expand Up @@ -126,11 +122,12 @@ jobs:
run: git fetch --tags origin

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

- name: Create GitHub Release
if: steps.publish-needed.outputs.published == 'false'
Expand All @@ -154,28 +151,16 @@ jobs:
git merge ${{ github.ref_name }}
git push origin ${{ steps.target.outputs.target }}
- name: Ensure `next` is a minor version ahead of `main`
if: steps.target.outputs.target == 'main'
run: |
git checkout next
git pull
yarn release:ensure-next-ahead --main-version "${{ steps.version.outputs.current-version }}"
git add ..
git commit -m "Bump next to be one minor ahead of main [skip ci]"
git push origin next
- name: Sync CHANGELOG.md from `main` to `next`
if: steps.target.outputs.target == 'main'
if: github.ref_name == 'latest-release'
working-directory: .
run: |
git fetch origin next
git checkout next
git pull
git checkout origin/main ./CHANGELOG.md
git add ./CHANGELOG.md
git commit -m "Update CHANGELOG.md for v${{ steps.version.outputs.current-version }} [skip ci]" || true
git commit -m "Update CHANGELOG.md for v${{ steps.version.outputs.current-version }} [skip ci]"
git push origin next
- name: Sync version JSONs from `next-release` to `main`
Expand All @@ -191,6 +176,10 @@ jobs:
git commit -m "Update $VERSION_FILE for v${{ steps.version.outputs.current-version }}"
git push origin main
- name: Overwrite main with next
if: steps.target.outputs.target == 'next' && steps.is-prerelease.outputs.prerelease == 'false'
run: git push --force origin next:main

- name: Report job failure to Discord
if: failure()
env:
Expand Down
Loading

0 comments on commit f73a915

Please sign in to comment.