-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflows: Allow point releases after a new RC is out #32560
Changes from all commits
d6c0b18
44bcd51
7368450
41305e7
18a759a
04e3198
0b72906
bc4af8d
14f453f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,46 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
compute-stable-branches: | ||
name: Compute current and next stable release branches | ||
runs-on: ubuntu-latest | ||
outputs: | ||
current_stable_branch: ${{ steps.get_branches.outputs.current_stable_branch }} | ||
next_stable_branch: ${{ steps.get_branches.outputs.next_stable_branch }} | ||
steps: | ||
- name: Get current and next stable release branches | ||
id: get_branches | ||
run: | | ||
curl \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-o latest.json \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases/latest" | ||
LATEST_STABLE_TAG=$(jq --raw-output '.tag_name' latest.json) | ||
IFS='.' read LATEST_STABLE_MAJOR LATEST_STABLE_MINOR LATEST_STABLE_PATCH <<< "${LATEST_STABLE_TAG#v}" | ||
echo "::set-output name=current_stable_branch::release/${LATEST_STABLE_MAJOR}.${LATEST_STABLE_MINOR}" | ||
if [[ ${LATEST_STABLE_MINOR} == "9" ]]; then | ||
echo "::set-output name=next_stable_branch::release/$((LATEST_STABLE_MAJOR + 1)).0" | ||
else | ||
echo "::set-output name=next_stable_branch::release/${LATEST_STABLE_MAJOR}.$((LATEST_STABLE_MINOR + 1))" | ||
fi | ||
|
||
bump-version: | ||
name: Bump version | ||
runs-on: ubuntu-latest | ||
needs: compute-stable-branches | ||
if: | | ||
github.repository == 'WordPress/gutenberg' && | ||
github.event_name == 'workflow_dispatch' && | ||
github.ref == 'refs/heads/trunk' && ( | ||
github.event.inputs.version == 'rc' || | ||
github.event.inputs.version == 'stable' | ||
github.event_name == 'workflow_dispatch' && ( | ||
( | ||
github.ref == 'refs/heads/trunk' || | ||
endsWith( github.ref, needs.compute-stable-branches.outputs.next_stable_branch ) | ||
) && ( | ||
github.event.inputs.version == 'rc' || | ||
github.event.inputs.version == 'stable' | ||
) || ( | ||
endsWith( github.ref, needs.compute-stable-branches.outputs.current_stable_branch ) && | ||
github.event.inputs.version == 'stable' | ||
) | ||
) | ||
outputs: | ||
old_version: ${{ steps.get_version.outputs.old_version }} | ||
|
@@ -91,13 +122,17 @@ jobs: | |
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" gutenberg.php | ||
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" readme.txt | ||
|
||
- name: Commit the version bump | ||
- name: Commit the version bump to the release branch | ||
run: | | ||
git add gutenberg.php package.json package-lock.json readme.txt | ||
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}" | ||
git push --set-upstream origin "${{ steps.get_version.outputs.release_branch }}" | ||
|
||
- name: Cherry-pick to trunk | ||
- name: Fetch trunk | ||
if: ${{ github.ref != 'refs/heads/trunk' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is the important change right? Preventing the cherry-pick if we don't use trunk as a base branch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah no, not really, we were doing that before -- just using a different heuristic, i.e. by checking whether the version in However, we limited at the time which branches the workflow could be triggered to |
||
run: git fetch --depth=1 origin trunk | ||
|
||
- name: Cherry-pick the version bump commit to trunk | ||
run: | | ||
git checkout trunk | ||
git pull | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the crucial change: We're now also allowing to run this job from the "current stable branch", i.e. the branch the latest stable release belongs to (e.g. the
release/10.8
branch, if the latest release is10.8.2
); but only to release a new stable (i.e. point) release (e.g.10.8.3
).