Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

Commit b795785

Browse files
committed
Workflow and docs refresh
1 parent 5d1194e commit b795785

16 files changed

Lines changed: 893 additions & 262 deletions

.github/release-drafter.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
version-template: '$MAJOR.$MINOR.$PATCH'
4+
change-template: '- $TITLE by @$AUTHOR in #$NUMBER'
5+
change-title-escapes: '\<*_&`'
6+
no-changes-template: '- No user-facing changes in this release.'
7+
template: |
8+
## Summary
9+
10+
$CHANGES
11+
12+
## Contributors
13+
14+
$CONTRIBUTORS
15+
16+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
17+
18+
categories:
19+
- title: Features
20+
labels:
21+
- feature
22+
- enhancement
23+
- title: Fixes
24+
labels:
25+
- fix
26+
- bug
27+
- bugfix
28+
- title: Security
29+
labels:
30+
- security
31+
- title: Documentation
32+
labels:
33+
- documentation
34+
- docs
35+
- title: Testing and CI
36+
labels:
37+
- tests
38+
- ci
39+
- title: Maintenance
40+
labels:
41+
- chore
42+
- dependencies
43+
- refactor
44+
45+
exclude-labels:
46+
- skip-changelog
47+
48+
version-resolver:
49+
major:
50+
labels:
51+
- major
52+
minor:
53+
labels:
54+
- minor
55+
- feature
56+
- enhancement
57+
patch:
58+
labels:
59+
- patch
60+
- fix
61+
- bug
62+
- bugfix
63+
- security
64+
- documentation
65+
- docs
66+
- tests
67+
- ci
68+
- chore
69+
- dependencies
70+
- refactor
71+
default: patch
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
name: dependabot-auto-merge
2-
on: pull_request_target
2+
on:
3+
pull_request_target:
4+
types: [opened, reopened, synchronize]
35

46
permissions:
57
pull-requests: write
68
contents: write
79

10+
concurrency:
11+
group: dependabot-auto-merge-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
814
jobs:
915
dependabot:
1016
runs-on: ubuntu-latest
11-
if: ${{ github.actor == 'dependabot[bot]' }}
17+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && ! github.event.pull_request.draft }}
1218
steps:
13-
1419
- name: Dependabot metadata
1520
id: metadata
1621
uses: dependabot/fetch-metadata@v2.5.0
1722
with:
1823
github-token: "${{ secrets.GITHUB_TOKEN }}"
19-
20-
- name: Auto-merge Dependabot PRs for semver-minor updates
21-
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
22-
run: gh pr merge --auto --merge "$PR_URL"
23-
env:
24-
PR_URL: ${{github.event.pull_request.html_url}}
25-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
26-
27-
- name: Auto-merge Dependabot PRs for semver-patch updates
28-
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
29-
run: gh pr merge --auto --merge "$PR_URL"
24+
25+
- name: Enable auto-merge for patch and minor updates
26+
if: ${{ contains(fromJSON('["version-update:semver-patch","version-update:semver-minor"]'), steps.metadata.outputs.update-type) }}
27+
run: gh pr merge --auto --merge "${{ github.event.pull_request.html_url }}"
3028
env:
31-
PR_URL: ${{github.event.pull_request.html_url}}
32-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/phpstan.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,55 @@
11
name: PHPStan
22

33
on:
4+
workflow_dispatch:
45
push:
6+
branches: [main]
57
paths:
6-
- '**.php'
8+
- '**/*.php'
9+
- 'composer.json'
10+
- 'composer.lock'
711
- 'phpstan.neon.dist'
12+
- '.github/workflows/phpstan.yml'
13+
pull_request:
14+
branches: [main]
15+
paths:
16+
- '**/*.php'
17+
- 'composer.json'
18+
- 'composer.lock'
19+
- 'phpstan.neon.dist'
20+
- '.github/workflows/phpstan.yml'
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: phpstan-${{ github.event.pull_request.number || github.ref }}
27+
cancel-in-progress: true
28+
29+
env:
30+
COMPOSER_NO_INTERACTION: 1
831

932
jobs:
1033
phpstan:
1134
name: phpstan
1235
runs-on: ubuntu-latest
36+
timeout-minutes: 15
1337
steps:
1438
- uses: actions/checkout@v6
1539

1640
- name: Setup PHP
1741
uses: shivammathur/setup-php@v2
1842
with:
1943
php-version: '8.4'
44+
extensions: none, dom, mbstring, sqlite, pdo_sqlite
45+
tools: composer:v2
2046
coverage: none
2147

48+
- name: Validate composer.json
49+
run: composer validate --strict
50+
2251
- name: Install composer dependencies
2352
uses: ramsey/composer-install@v3
2453

2554
- name: Run PHPStan
26-
run: ./vendor/bin/phpstan --error-format=github
55+
run: ./vendor/bin/phpstan analyse --memory-limit=512M --error-format=github
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Publish Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release tag to publish, for example v0.9.1'
8+
required: true
9+
type: string
10+
target:
11+
description: 'Branch to release from'
12+
required: true
13+
default: main
14+
type: string
15+
prerelease:
16+
description: 'Publish this as a prerelease'
17+
required: true
18+
default: false
19+
type: boolean
20+
latest:
21+
description: 'Mark the published release as latest'
22+
required: true
23+
default: 'true'
24+
type: choice
25+
options:
26+
- 'true'
27+
- 'false'
28+
- legacy
29+
30+
permissions:
31+
contents: write
32+
pull-requests: read
33+
34+
concurrency:
35+
group: publish-release
36+
cancel-in-progress: false
37+
38+
env:
39+
COMPOSER_NO_INTERACTION: 1
40+
41+
jobs:
42+
publish:
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 30
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v6
49+
with:
50+
ref: ${{ inputs.target }}
51+
fetch-depth: 0
52+
53+
- name: Setup PHP
54+
uses: shivammathur/setup-php@v2
55+
with:
56+
php-version: '8.4'
57+
extensions: none, dom, mbstring, sqlite, pdo_sqlite
58+
tools: composer:v2
59+
coverage: none
60+
61+
- name: Validate release inputs
62+
id: release_meta
63+
shell: bash
64+
run: |
65+
if [[ ! "${{ inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$ ]]; then
66+
echo "Version must look like v1.2.3 or v1.2.3-rc.1"
67+
exit 1
68+
fi
69+
70+
echo "version_number=${INPUT_VERSION#v}" >> "$GITHUB_OUTPUT"
71+
env:
72+
INPUT_VERSION: ${{ inputs.version }}
73+
74+
- name: Ensure tag does not already exist
75+
shell: bash
76+
run: |
77+
if git ls-remote --exit-code --tags origin "refs/tags/${{ inputs.version }}" >/dev/null 2>&1; then
78+
echo "Tag ${{ inputs.version }} already exists on origin."
79+
exit 1
80+
fi
81+
82+
- name: Validate composer.json
83+
run: composer validate --strict
84+
85+
- name: Install composer dependencies
86+
uses: ramsey/composer-install@v3
87+
88+
- name: Run test suite
89+
run: vendor/bin/pest --no-coverage
90+
91+
- name: Run static analysis
92+
run: php -d memory_limit=512M vendor/bin/phpstan analyse
93+
94+
- name: Publish GitHub release
95+
id: release
96+
uses: release-drafter/release-drafter@v6
97+
with:
98+
publish: true
99+
name: ${{ inputs.version }}
100+
tag: ${{ inputs.version }}
101+
version: ${{ steps.release_meta.outputs.version_number }}
102+
prerelease: ${{ inputs.prerelease }}
103+
latest: ${{ inputs.latest }}
104+
commitish: ${{ inputs.target }}
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Update changelog
109+
uses: stefanzweifel/changelog-updater-action@v1
110+
with:
111+
latest-version: ${{ inputs.version }}
112+
release-notes: ${{ steps.release.outputs.body }}
113+
114+
- name: Commit updated changelog
115+
uses: stefanzweifel/git-auto-commit-action@v7
116+
with:
117+
branch: ${{ inputs.target }}
118+
commit_message: "docs: update changelog for ${{ inputs.version }}"
119+
file_pattern: CHANGELOG.md
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release Drafter
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: read
11+
12+
concurrency:
13+
group: release-drafter-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
update_release_draft:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
21+
steps:
22+
- name: Update release draft
23+
uses: release-drafter/release-drafter@v6
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)