mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
ci: add ability to rc and graduate a release
This commit is contained in:
@@ -5,6 +5,17 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
release-candidate:
|
||||||
|
description: 'Cut a release-candidate (prerelease) instead of a normal release.'
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
graduate:
|
||||||
|
description: 'Graduate the current RC to its final version (drops the -rc.N suffix).'
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RELEASE_BRANCH: release-please--branches--main--components--github-actions-magento2
|
RELEASE_BRANCH: release-please--branches--main--components--github-actions-magento2
|
||||||
@@ -17,10 +28,34 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
releases_created: ${{ steps.release.outputs.releases_created }}
|
releases_created: ${{ steps.release.outputs.releases_created }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Reject conflicting inputs
|
||||||
|
if: inputs.release-candidate && inputs.graduate
|
||||||
|
run: |
|
||||||
|
echo "::error::release-candidate and graduate are mutually exclusive — pick one."
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
if: inputs.graduate
|
||||||
|
|
||||||
|
- name: Compute graduate version
|
||||||
|
id: graduate
|
||||||
|
if: inputs.graduate
|
||||||
|
run: |
|
||||||
|
CURRENT=$(jq -r '."."' .release-please-manifest.json)
|
||||||
|
if [[ "$CURRENT" != *-* ]]; then
|
||||||
|
echo "::error::Manifest version $CURRENT has no prerelease suffix to graduate from."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GRADUATED="${CURRENT%%-*}"
|
||||||
|
echo "Graduating $CURRENT -> $GRADUATED"
|
||||||
|
echo "VERSION=${GRADUATED}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- id: release
|
- id: release
|
||||||
uses: googleapis/release-please-action@v4
|
uses: googleapis/release-please-action@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
|
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
|
||||||
|
versioning-strategy: ${{ inputs.release-candidate && 'prerelease' || '' }}
|
||||||
|
release-as: ${{ steps.graduate.outputs.VERSION || '' }}
|
||||||
|
|
||||||
- name: Check if release branch exists
|
- name: Check if release branch exists
|
||||||
id: branch-check
|
id: branch-check
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"bump-patch-for-minor-pre-major": true,
|
"bump-patch-for-minor-pre-major": true,
|
||||||
"draft-pull-request": true,
|
"draft-pull-request": true,
|
||||||
"prerelease": true,
|
"prerelease": true,
|
||||||
|
"prerelease-type": "rc",
|
||||||
"include-component-in-tag": false,
|
"include-component-in-tag": false,
|
||||||
"include-v-in-tag": true,
|
"include-v-in-tag": true,
|
||||||
"pull-request-title-pattern": "chore: release ${version}",
|
"pull-request-title-pattern": "chore: release ${version}",
|
||||||
|
|||||||
Reference in New Issue
Block a user