File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*.*.*'
7+ workflow_dispatch :
8+
9+ jobs :
10+ release :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
14+
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v4
18+
19+ - name : Set up PHP
20+ uses : shivammathur/setup-php@v2
21+ with :
22+ php-version : ' 8.2'
23+ coverage : none
24+ tools : composer
25+
26+ - name : Install dependencies
27+ run : composer install --no-progress --no-suggest --prefer-dist
28+
29+ - name : Run tests
30+ run : vendor/bin/phpunit --testdox
31+
32+ - name : Extract changelog entry
33+ run : |
34+ RAW_VERSION=${GITHUB_REF_NAME#v}
35+
36+ if [[ "$RAW_VERSION" == *"-test" ]]; then
37+ VERSION=${RAW_VERSION%-test}
38+ else
39+ VERSION=$RAW_VERSION
40+ fi
41+
42+ echo "Looking for version: $VERSION (from tag $RAW_VERSION)"
43+
44+ awk "/^## \\[$VERSION\\]/ {flag=1; next} /^## \\[/ {flag=0} flag {print}" CHANGELOG.md > RELEASE_NOTES.md
45+
46+ if [ ! -s RELEASE_NOTES.md ]; then
47+ echo "⚠️ No changelog entry found, using default message"
48+ echo "Release $RAW_VERSION" > RELEASE_NOTES.md
49+ fi
50+
51+ echo "---- RELEASE NOTES ----"
52+ cat RELEASE_NOTES.md
53+
54+ - name : Create GitHub Release
55+ uses : softprops/action-gh-release@v2
56+ with :
57+ tag_name : ${{ github.ref_name }}
58+ name : Release ${{ github.ref_name }}
59+ body_path : RELEASE_NOTES.md
60+ env :
61+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments