Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: PHP Composer

on:
push:
branches: ["main"]
branches:
- main
- "[0-9]+.[0-9]+"
pull_request:
branches: ["main"]

permissions:
contents: read
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<major>.<minor>'); 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: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down