Skip to content

Commit fa74ed8

Browse files
authored
feat: migrate release planning to release-tool
Replace the transitional Python planner with release-tool v0.2.0, expose ReleasePlan v1 workflow outputs, use complete Git history and keep summaries security-safe. Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent 81facc5 commit fa74ed8

5 files changed

Lines changed: 259 additions & 470 deletions

File tree

‎.github/workflows/release-plan.yml‎

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,60 @@ name: Nextcloud release plan
66
on:
77
workflow_call:
88
inputs:
9-
version:
10-
description: Release version in MAJOR.MINOR.PATCH form
9+
branch:
10+
description: Release branch to plan.
1111
required: true
1212
type: string
13-
stable_branch:
14-
description: Stable branch that is allowed to release
15-
required: true
13+
ref:
14+
description: Optional planning ref or commit SHA.
15+
required: false
1616
type: string
17-
milestone:
18-
description: Milestone title that must be closed with no open issues
17+
default: ''
18+
version:
19+
description: Optional explicit release version override.
1920
required: false
2021
type: string
2122
default: ''
22-
blocker_queries:
23-
description: JSON array of GitHub issue search fragments that must return zero open items
23+
channel:
24+
description: Release channel (alpha, beta, rc or final).
2425
required: false
2526
type: string
26-
default: '[]'
27-
appinfo_path:
28-
description: Path to the Nextcloud app info.xml
27+
default: final
28+
mode:
29+
description: Release mode (normal or security).
2930
required: false
3031
type: string
31-
default: appinfo/info.xml
32-
changelog_path:
33-
description: Path to the changelog
32+
default: normal
33+
safe_public_text:
34+
description: Optional explicitly public-safe release text.
35+
required: false
36+
type: string
37+
default: ''
38+
ignore_open_backport:
39+
description: Explicitly override matching open backport blockers.
40+
required: false
41+
type: boolean
42+
default: false
43+
create_follow_up_milestone:
44+
description: Request follow-up milestone creation in a later stage.
45+
required: false
46+
type: boolean
47+
default: false
48+
config_path:
49+
description: Consumer release configuration path.
3450
required: false
3551
type: string
36-
default: CHANGELOG.md
52+
default: .nextcloud-release.yml
53+
outputs:
54+
plan:
55+
description: ReleasePlan v1 JSON.
56+
value: ${{ jobs.plan.outputs.plan }}
57+
ready:
58+
description: Whether the release is ready for the next stage.
59+
value: ${{ jobs.plan.outputs.ready }}
60+
tool_version:
61+
description: Exact release-tool version used for planning.
62+
value: ${{ jobs.plan.outputs.tool_version }}
3763

3864
permissions:
3965
contents: read
@@ -45,19 +71,28 @@ jobs:
4571
name: Release plan
4672
runs-on: ubuntu-latest
4773
timeout-minutes: 10
74+
outputs:
75+
plan: ${{ steps.release-plan.outputs.plan }}
76+
ready: ${{ steps.release-plan.outputs.ready }}
77+
tool_version: ${{ steps.release-plan.outputs.tool-version }}
4878
steps:
49-
- name: Checkout caller
79+
- name: Checkout caller with release history
5080
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5181
with:
5282
persist-credentials: false
83+
fetch-depth: 0
5384

54-
- name: Build release plan
85+
- id: release-plan
86+
name: Build release plan
5587
uses: $/actions/release-plan
5688
with:
89+
branch: ${{ inputs.branch }}
90+
ref: ${{ inputs.ref }}
5791
version: ${{ inputs.version }}
58-
stable-branch: ${{ inputs.stable_branch }}
59-
milestone: ${{ inputs.milestone }}
60-
blocker-queries: ${{ inputs.blocker_queries }}
61-
appinfo-path: ${{ inputs.appinfo_path }}
62-
changelog-path: ${{ inputs.changelog_path }}
92+
channel: ${{ inputs.channel }}
93+
mode: ${{ inputs.mode }}
94+
safe-public-text: ${{ inputs.safe_public_text }}
95+
ignore-open-backport: ${{ inputs.ignore_open_backport }}
96+
create-follow-up-milestone: ${{ inputs.create_follow_up_milestone }}
97+
config-path: ${{ inputs.config_path }}
6398
github-token: ${{ github.token }}

‎actions/release-plan/action.yml‎

Lines changed: 135 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,155 @@
22
# SPDX-License-Identifier: AGPL-3.0-or-later
33

44
name: Nextcloud release plan
5-
description: Validate whether a Nextcloud app release is ready
5+
description: Build a read-only ReleasePlan v1 with the verified PHP release-tool.
66

77
inputs:
8-
version:
9-
description: Release version in MAJOR.MINOR.PATCH form
10-
required: true
11-
stable-branch:
12-
description: Stable branch that is allowed to release
8+
branch:
9+
description: Release branch to plan.
1310
required: true
14-
milestone:
15-
description: Milestone title that must be closed with no open issues
11+
ref:
12+
description: Optional planning ref or commit SHA.
13+
required: false
14+
default: ''
15+
version:
16+
description: Optional explicit release version override, with or without the configured tag prefix.
1617
required: false
1718
default: ''
18-
blocker-queries:
19-
description: JSON array of GitHub issue search fragments that must return zero open items
19+
channel:
20+
description: Release channel (alpha, beta, rc or final).
2021
required: false
21-
default: '[]'
22-
appinfo-path:
23-
description: Path to the Nextcloud app info.xml
22+
default: final
23+
mode:
24+
description: Release mode (normal or security).
2425
required: false
25-
default: appinfo/info.xml
26-
changelog-path:
27-
description: Path to the changelog
26+
default: normal
27+
safe-public-text:
28+
description: Optional explicitly public-safe release text.
2829
required: false
29-
default: CHANGELOG.md
30+
default: ''
31+
ignore-open-backport:
32+
description: Explicitly override matching open backport blockers.
33+
required: false
34+
default: 'false'
35+
create-follow-up-milestone:
36+
description: Request follow-up milestone creation in a later mutating stage.
37+
required: false
38+
default: 'false'
39+
config-path:
40+
description: Consumer release configuration path.
41+
required: false
42+
default: .nextcloud-release.yml
3043
github-token:
31-
description: GitHub token used for milestone and blocker checks
44+
description: GitHub token used for read-only planning API calls.
3245
required: true
3346

47+
outputs:
48+
plan:
49+
description: ReleasePlan v1 JSON.
50+
value: ${{ steps.plan.outputs.plan }}
51+
ready:
52+
description: Whether the plan is ready for the next stage.
53+
value: ${{ steps.plan.outputs.ready }}
54+
tool-version:
55+
description: Exact release-tool version used for planning.
56+
value: ${{ steps.setup.outputs.version }}
57+
3458
runs:
3559
using: composite
3660
steps:
37-
- name: Build release plan
61+
- id: setup
62+
name: Setup release-tool
63+
uses: $/actions/setup-release-tool
64+
with:
65+
version: '0.2.0'
66+
67+
- id: plan
68+
name: Build ReleasePlan v1
3869
shell: bash
3970
env:
4071
GITHUB_TOKEN: ${{ inputs.github-token }}
41-
RELEASE_PLAN_VERSION: ${{ inputs.version }}
42-
RELEASE_PLAN_STABLE_BRANCH: ${{ inputs.stable-branch }}
43-
RELEASE_PLAN_MILESTONE: ${{ inputs.milestone }}
44-
RELEASE_PLAN_BLOCKER_QUERIES: ${{ inputs.blocker-queries }}
45-
RELEASE_PLAN_APPINFO_PATH: ${{ inputs.appinfo-path }}
46-
RELEASE_PLAN_CHANGELOG_PATH: ${{ inputs.changelog-path }}
47-
run: python3 "$GITHUB_ACTION_PATH/../../scripts/release_plan.py"
72+
RELEASE_TOOL_PATH: ${{ steps.setup.outputs.path }}
73+
RELEASE_TOOL_VERSION: ${{ steps.setup.outputs.version }}
74+
RELEASE_BRANCH: ${{ inputs.branch }}
75+
RELEASE_REF: ${{ inputs.ref }}
76+
RELEASE_VERSION: ${{ inputs.version }}
77+
RELEASE_CHANNEL: ${{ inputs.channel }}
78+
RELEASE_MODE: ${{ inputs.mode }}
79+
RELEASE_SAFE_PUBLIC_TEXT: ${{ inputs.safe-public-text }}
80+
RELEASE_IGNORE_OPEN_BACKPORT: ${{ inputs.ignore-open-backport }}
81+
RELEASE_CREATE_FOLLOW_UP_MILESTONE: ${{ inputs.create-follow-up-milestone }}
82+
RELEASE_CONFIG_PATH: ${{ inputs.config-path }}
83+
run: |
84+
set -euo pipefail
85+
86+
args=(
87+
release:plan
88+
--config "${RELEASE_CONFIG_PATH}"
89+
--root .
90+
--branch "${RELEASE_BRANCH}"
91+
--channel "${RELEASE_CHANNEL}"
92+
--mode "${RELEASE_MODE}"
93+
--json
94+
)
95+
96+
if [[ -n "${RELEASE_REF}" ]]; then
97+
args+=(--ref "${RELEASE_REF}")
98+
fi
99+
if [[ -n "${RELEASE_VERSION}" ]]; then
100+
args+=(--release-version "${RELEASE_VERSION}")
101+
fi
102+
if [[ -n "${RELEASE_SAFE_PUBLIC_TEXT}" ]]; then
103+
args+=(--safe-public-text "${RELEASE_SAFE_PUBLIC_TEXT}")
104+
fi
105+
if [[ "${RELEASE_IGNORE_OPEN_BACKPORT}" == "true" ]]; then
106+
args+=(--ignore-open-backport)
107+
fi
108+
if [[ "${RELEASE_CREATE_FOLLOW_UP_MILESTONE}" == "true" ]]; then
109+
args+=(--create-follow-up-milestone)
110+
fi
111+
112+
plan_file="${RUNNER_TEMP}/release-plan.json"
113+
set +e
114+
php "${RELEASE_TOOL_PATH}" "${args[@]}" > "${plan_file}"
115+
exit_code=$?
116+
set -e
117+
118+
if [[ "${exit_code}" -ne 0 && "${exit_code}" -ne 3 ]]; then
119+
cat "${plan_file}"
120+
exit "${exit_code}"
121+
fi
122+
123+
ready="$(php -r '
124+
$plan = json_decode(file_get_contents($argv[1]), true, 512, JSON_THROW_ON_ERROR);
125+
echo !empty($plan["ready"]) ? "true" : "false";
126+
' "${plan_file}")"
127+
128+
delimiter="release-plan-${RANDOM}-${RANDOM}"
129+
{
130+
echo "plan<<${delimiter}"
131+
cat "${plan_file}"
132+
echo "${delimiter}"
133+
echo "ready=${ready}"
134+
} >> "${GITHUB_OUTPUT}"
135+
136+
{
137+
echo "## Release plan"
138+
echo
139+
php -r '
140+
$plan = json_decode(file_get_contents($argv[1]), true, 512, JSON_THROW_ON_ERROR);
141+
printf("- Tool: release-tool %s\n", $argv[2]);
142+
printf("- Plan: `%s`\n", $plan["id"]);
143+
printf("- Branch: `%s`\n", $plan["branch"]);
144+
printf("- Planning base: `%s`\n", $plan["planning_base_sha"]);
145+
printf("- Version: `%s` -> `%s`\n", $plan["current_version"], $plan["proposed_version"]);
146+
printf("- Channel: `%s`\n", $plan["channel"]);
147+
printf("- Ready: **%s**\n", !empty($plan["ready"]) ? "yes" : "no");
148+
foreach ($plan["warnings"] as $warning) {
149+
printf("- Warning: %s\n", str_replace(["\r", "\n"], " ", (string) $warning));
150+
}
151+
' "${plan_file}" "${RELEASE_TOOL_VERSION}"
152+
} >> "${GITHUB_STEP_SUMMARY}"
153+
154+
cat "${plan_file}"
155+
156+
exit "${exit_code}"

0 commit comments

Comments
 (0)