ci: Schedule creation of minor and patch PRs (#27199)

This commit is contained in:
Matsu
2026-03-18 10:31:18 +02:00
committed by GitHub
parent 827e8680e3
commit 8995c25512
5 changed files with 60 additions and 71 deletions

View File

@@ -1,69 +0,0 @@
name: Create Branch For Patch Release
on:
workflow_dispatch:
inputs:
commit_shas:
description: 'Comma-separated commit SHAs'
required: true
old_version:
description: 'Old version to be patched'
required: true
default: '1.0.0'
new_version:
description: 'The new patch version'
required: true
default: '1.0.1'
resumeUrl:
description: 'n8n workflow resume URL'
required: true
jobs:
create-branch:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Validate inputs
run: |
if ! [[ "${{ inputs.old_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+(\.[0-9A-Za-z]+)*)?$ ]]; then
echo "Invalid old version format: ${{ inputs.old_version }}"
exit 1
fi
if ! [[ "${{ inputs.new_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+(\.[0-9A-Za-z]+)*)?$ ]]; then
echo "Invalid new version format: ${{ inputs.new_version }}"
exit 1
fi
- name: Notify if inputs are invalid
if: ${{ failure() }}
run: |
curl -X POST -H "Content-Type: application/json" -d '{ "success": false, "message": "The old or new version you provided is invalid, make sure they both follow the SemVer format" }' ${{ inputs.resumeUrl }}
exit 1
- name: Setup, cherry-pick and push branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git switch "n8n@${{ inputs.old_version }}" --detach
BRANCH="patch/${{ inputs.new_version }}"
git checkout -b "$BRANCH"
IFS=',' read -ra SHAS <<< "${{ inputs.commit_shas }}"
for sha in "${SHAS[@]}"; do
sha=$(echo "$sha" | xargs)
if ! git merge-base --is-ancestor "$sha" HEAD; then
echo "Cherry-picking commit $sha"
git cherry-pick "$sha"
else
echo "Commit $sha is already in the branch, skipping"
fi
done
git push -f origin "$BRANCH"
- name: Notify if cherry-pick is successful
if: ${{ success() }}
run: |
curl -X POST -H "Content-Type: application/json" -d '{ "success": true }' ${{ inputs.resumeUrl }}
- name: Notify if cherry-pick is not successful
if: ${{ failure() }}
run: |
curl -X POST -H "Content-Type: application/json" -d '{ "success": false, "message": "There was a conflict when trying to create the branch, please do the cherry-pick and resolve the conflicts manually or do not include the PRs that caused the conflict" }' ${{ inputs.resumeUrl }}

View File

@@ -2,8 +2,8 @@ name: 'Release: Create Minor Release PR'
on:
workflow_dispatch:
# schedule:
# - cron: 0 13 * * 1
schedule:
- cron: 0 13 * * 1 # 2pm CET (UTC+1), Monday
jobs:
create-release-pr:
@@ -13,3 +13,18 @@ jobs:
with:
base-branch: master
release-type: minor
notify-slack:
name: Notify Slack
needs: [create-release-pr]
if: needs.create-release-pr.result == 'success' && needs.create-release-pr.outputs.pull-request-number != ''
runs-on: ubuntu-latest
steps:
- name: Post to Slack
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
method: chat.postMessage
token: ${{ secrets.RELEASE_HELPER_SLACK_TOKEN }}
payload: |
channel: C036AELNMV0
text: ":rocket: Minor release PR created. <${{ github.server_url }}/${{ github.repository }}/pull/${{ needs.create-release-pr.outputs.pull-request-number }}|View PR> — close it to cancel the release."

View File

@@ -2,6 +2,13 @@ name: 'Release: Create Patch Release PR'
run-name: 'Release: Create Patch Release PR for track ${{ inputs.track }}'
on:
workflow_call:
inputs:
track:
description: 'Release Track'
required: true
type: string
workflow_dispatch:
inputs:
track:
@@ -53,3 +60,18 @@ jobs:
with:
base-branch: ${{ needs.determine-version-info.outputs.release_candidate_branch }}
release-type: patch
notify-slack:
name: Notify Slack
needs: [create-release-pr]
if: needs.create-release-pr.result == 'success' && needs.create-release-pr.outputs.pull-request-number != ''
runs-on: ubuntu-latest
steps:
- name: Post to Slack
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
method: chat.postMessage
token: ${{ secrets.RELEASE_HELPER_SLACK_TOKEN }}
payload: |
channel: C036AELNMV0
text: ":rocket: Patch release PR created for *${{ inputs.track }}* track. <${{ github.server_url }}/${{ github.repository }}/pull/${{ needs.create-release-pr.outputs.pull-request-number }}|View PR> — close it to cancel the release."

View File

@@ -13,6 +13,11 @@ on:
required: true
type: string
outputs:
pull-request-number:
description: 'Number of the created pull request'
value: ${{ jobs.create-release-pr.outputs.pull-request-number }}
workflow_dispatch:
inputs:
base-branch:

View File

@@ -0,0 +1,16 @@
name: 'Release: Schedule Patch Release PRs'
on:
schedule:
- cron: '0 8 * * 2-5' # 9am CET (UTC+1), TuesdayFriday
jobs:
create-patch-prs:
name: Create patch release PR (${{ matrix.track }})
strategy:
matrix:
track: [stable, beta, v1]
uses: ./.github/workflows/release-create-patch-pr.yml
secrets: inherit
with:
track: ${{ matrix.track }}