Skip to content

Commit c4961f0

Browse files
committed
add workflows
1 parent 473e3fb commit c4961f0

3 files changed

Lines changed: 138 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Context**
11+
Contao version:
12+
Bundle version:
13+
PHP version:
14+
15+
**Description**
16+
<!-- Please describe the issue and provide reproduction steps (in an clean contao installation). If you you're reporting an error, please provide the full error message (ideally an screenshot of the error page in dev mode) -->

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- php: '8.4'
15+
contao: '5.7.*'
16+
- php: '8.5'
17+
contao: '^5.7'
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
coverage: none
26+
tools: composer:v2
27+
28+
- name: Select Contao version
29+
run: composer require --no-update "contao/core-bundle:${{ matrix.contao }}" "contao/test-case:${{ matrix.contao }}"
30+
31+
- name: Install dependencies
32+
run: composer update --no-interaction --prefer-dist
33+
34+
- name: Validate Composer metadata
35+
run: composer validate --strict
36+
37+
- name: Check PHP syntax
38+
run: find src tests -name '*.php' -print0 | xargs -0 -n1 php -l
39+
40+
- name: Run tests
41+
run: composer test

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out tagged revision
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.ref }}
20+
21+
- name: Create or update release
22+
env:
23+
GH_TOKEN: ${{ github.token }}
24+
TAG: ${{ github.ref_name }}
25+
shell: bash
26+
run: |
27+
set -euo pipefail
28+
29+
notes_file="${RUNNER_TEMP}/release-notes.md"
30+
31+
awk -v tag="${TAG}" '
32+
function changelog_tag(line, closing_bracket) {
33+
closing_bracket = index(line, "]")
34+
35+
if (closing_bracket == 0) {
36+
return ""
37+
}
38+
39+
return substr(line, 5, closing_bracket - 5)
40+
}
41+
42+
/^## \[/ {
43+
if (in_section) {
44+
exit
45+
}
46+
47+
if (tag != "Unreleased" && changelog_tag($0) == tag) {
48+
in_section = 1
49+
}
50+
51+
next
52+
}
53+
54+
in_section {
55+
lines[++line_count] = $0
56+
}
57+
58+
END {
59+
while (line_count > 0 && lines[line_count] == "") {
60+
--line_count
61+
}
62+
63+
for (line_number = 1; line_number <= line_count; ++line_number) {
64+
print lines[line_number]
65+
}
66+
}
67+
' CHANGELOG.md > "${notes_file}"
68+
69+
if existing_notes="$(gh release view "${TAG}" --json body --jq '.body')"; then
70+
if [[ -n "${existing_notes}" ]]; then
71+
echo "Release ${TAG} already has notes; leaving it unchanged."
72+
elif [[ -s "${notes_file}" ]]; then
73+
gh release edit "${TAG}" --notes-file "${notes_file}"
74+
else
75+
echo "Release ${TAG} has no notes and no matching changelog section."
76+
fi
77+
78+
exit 0
79+
fi
80+
81+
gh release create "${TAG}" --title "${TAG}" --notes-file "${notes_file}"

0 commit comments

Comments
 (0)