From 07d7aa5a14b3c47926050c7856ebf2bccfa5c5fc Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 4 Jul 2026 20:23:08 +0100 Subject: [PATCH] Migrate to Symfony 8.1 - Bump symfony/http-foundation constraint to ^8.1 - Update php.yml to trigger on main and release-line branches - Make tag.yml compute the next patch from the PR's release line Co-Authored-By: Claude Fable 5 --- .github/workflows/php.yml | 5 +++-- .github/workflows/tag.yml | 22 ++++++++++++++-------- composer.json | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 0c17b42..fe50ab5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,9 +2,10 @@ name: PHP Composer on: push: - branches: ["main"] + branches: + - main + - "[0-9]+.[0-9]+" pull_request: - branches: ["main"] permissions: contents: read diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 4fb5eb6..4764539 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -20,20 +20,26 @@ jobs: fetch-depth: 0 fetch-tags: true - - name: Get latest tag and compute next patch version + - name: Compute next patch version for the PR's release line id: version + env: + HEAD_REF: ${{ github.event.pull_request.head.ref }} run: | - latest=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1) + if [[ ! "$HEAD_REF" =~ ^([0-9]+)\.([0-9]+)$ ]]; then + echo "PR head ref '$HEAD_REF' is not a release branch (expected '.'); refusing to tag." >&2 + exit 1 + fi + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + latest=$(git tag --sort=-v:refname | grep -E "^v${major}\.${minor}\.[0-9]+$" | head -1) if [ -z "$latest" ]; then - echo "next=v0.0.1" >> "$GITHUB_OUTPUT" + next="v${major}.${minor}.1" else - major=$(echo "$latest" | cut -d. -f1) - minor=$(echo "$latest" | cut -d. -f2) patch=$(echo "$latest" | cut -d. -f3) - next_patch=$((patch + 1)) - echo "next=${major}.${minor}.${next_patch}" >> "$GITHUB_OUTPUT" + next="v${major}.${minor}.$((patch + 1))" fi - echo "Latest tag: ${latest:-none}, next: $(cat "$GITHUB_OUTPUT" | grep next | cut -d= -f2)" + echo "next=$next" >> "$GITHUB_OUTPUT" + echo "Release line: ${major}.${minor}, latest tag: ${latest:-none}, next: $next" - name: Create and push tag run: | diff --git a/composer.json b/composer.json index 3338b8f..9d8b67f 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ ], "require": { "php": "^8.5", - "symfony/http-foundation": "^8.0" + "symfony/http-foundation": "^8.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0",