Skip to content

Commit 48014e8

Browse files
authored
Fix manual release workflow heredoc quoting (#81)
1 parent f5280cf commit 48014e8

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

.github/workflows/manual-release.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
3232
- name: Determine next version
3333
id: bump
34+
shell: bash
3435
run: |
3536
set -euo pipefail
3637
@@ -39,13 +40,7 @@ jobs:
3940
LATEST_TAG=$(git tag --sort=-v:refname | head -n 1)
4041
if [ -z "$LATEST_TAG" ]; then
4142
PREVIOUS_TAG=""
42-
BASE_VERSION=$(python - <<'PY'
43-
import re
44-
from pathlib import Path
45-
match = re.search(r"'version'\s*=>\s*'([^']+)'", Path("config/mcp-server.php").read_text())
46-
print(match.group(1) if match else "")
47-
PY
48-
)
43+
BASE_VERSION=$(grep -Po "'version'\s*=>\s*'\K[^']+" config/mcp-server.php | head -n 1)
4944
if [ -z "$BASE_VERSION" ]; then
5045
BASE_VERSION="0.1.0"
5146
fi
@@ -56,6 +51,9 @@ PY
5651
fi
5752
5853
IFS='.' read -r MAJOR MINOR PATCH <<<"$VERSION"
54+
MAJOR=${MAJOR:-0}
55+
MINOR=${MINOR:-0}
56+
PATCH=${PATCH:-0}
5957
6058
case "$RELEASE_TYPE" in
6159
minor)
@@ -75,25 +73,12 @@ PY
7573
echo "tag=$NEW_TAG"
7674
echo "previous_tag=$PREVIOUS_TAG"
7775
} >> "$GITHUB_OUTPUT"
78-
shell: bash
7976
8077
- name: Update configuration version
81-
run: |
82-
python - <<'PY'
83-
import os
84-
import re
85-
from pathlib import Path
86-
87-
version = os.environ["NEW_VERSION"]
88-
path = Path("config/mcp-server.php")
89-
content = path.read_text()
90-
updated, count = re.subn(r"'version'\s*=>\s*'[^']*'", f"'version' => '{version}'", content, count=1)
91-
if count == 0:
92-
raise SystemExit("Failed to update version in config/mcp-server.php")
93-
path.write_text(updated)
94-
PY
9578
env:
9679
NEW_VERSION: ${{ steps.bump.outputs.version }}
80+
run: |
81+
python -c "import os, re, pathlib, sys; path = pathlib.Path('config/mcp-server.php'); content = path.read_text(); pattern = r\"'version'\s*=>\s*'[^']*'\"; replacement = f\"'version' => '{os.environ['NEW_VERSION']}'\"; new, count = re.subn(pattern, replacement, content, count=1); (count != 0) or sys.exit('Failed to update version in config/mcp-server.php'); path.write_text(new)"
9782
9883
- name: Commit version update
9984
run: |

0 commit comments

Comments
 (0)