Skip to content

Commit 8be7c5c

Browse files
ci(release): Add a release GitHub action and prepare v0.15.0
1 parent 3fb1428 commit 8be7c5c

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Create Release
2+
# example: gh workflow run release.yml -f tag_name=v1.1.4 -f draft=true
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_name:
7+
default: ""
8+
draft:
9+
default: false
10+
prerelease:
11+
default: false
12+
13+
jobs:
14+
prepare-release:
15+
name: Prepare release
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check naming convention
20+
run: |
21+
VERIF=$(echo ${{ github.event.inputs.tag_name }} | grep -E "^v([0-9]{1,}\.)([0-9]{1,}\.)([0-9]{1,})(-(alpha|beta)\.[0-9]{1,})?$")
22+
if [ ! ${VERIF} ]
23+
then
24+
echo "Tag name '${{ github.event.inputs.tag_name }}' does not comply with naming convention vX.Y.Z"
25+
exit 1
26+
fi
27+
28+
- name: Set version number without v
29+
run: |
30+
echo "VERSION_NUMBER=$(echo ${{ github.event.inputs.tag_name }} | sed 's/v//g' )" >> $GITHUB_ENV
31+
32+
- name: Clone sources
33+
uses: actions/checkout@v2
34+
35+
- name: Check version ${{ env.VERSION_NUMBER }} consistency in files
36+
# Check src/Constants.php and CHANGELOG.md
37+
run: |
38+
CURRENT_DATE=$(date +'%Y-%m-%d')
39+
echo $CURRENT_DATE
40+
CHANGELOG_VERSION=$(grep -o -E "## \[(.*)\] - $CURRENT_DATE" CHANGELOG.md | head -1 | sed 's/ //g')
41+
echo $CHANGELOG_VERSION
42+
if [[ $CHANGELOG_VERSION == "##[${{ env.VERSION_NUMBER }}]-$CURRENT_DATE" ]]
43+
then
44+
echo "CHANGELOG VERSION OK"
45+
else
46+
echo "CHANGELOG VERSION KO"
47+
exit 1
48+
fi
49+
CONSTANT_VERSION=$(grep -E "public const VERSION = 'v(.*)';" src/Constants.php | sed 's/ //g')
50+
if [[ $CONSTANT_VERSION == "publicconstVERSION='v${{ env.VERSION_NUMBER }}';" ]]
51+
then
52+
echo "CONSTANT VERSION OK"
53+
else
54+
echo "CONSTANT VERSION KO"
55+
exit 1
56+
fi
57+
58+
- name: Create Tag ${{ github.event.inputs.tag_name }}
59+
uses: actions/github-script@v3
60+
with:
61+
github-token: ${{ github.token }}
62+
script: |
63+
github.git.createRef({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
ref: "refs/tags/${{ github.event.inputs.tag_name }}",
67+
sha: context.sha
68+
})
69+
70+
- name: Prepare release notes
71+
run: |
72+
VERSION_RELEASE_NOTES=$(awk -v ver="[${{ env.VERSION_NUMBER }}]" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p && NF' CHANGELOG.md)
73+
echo "$VERSION_RELEASE_NOTES" >> CHANGELOG.txt
74+
75+
76+
- name: Create release ${{ env.VERSION_NUMBER }}
77+
uses: softprops/action-gh-release@v1
78+
with:
79+
body_path: CHANGELOG.txt
80+
name: ${{ env.VERSION_NUMBER }}
81+
tag_name: ${{ github.event.inputs.tag_name }}
82+
draft: ${{ github.event.inputs.draft }}
83+
prerelease: ${{ github.event.inputs.prerelease }}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77

8+
## [0.15.0] - 2022-02-24
9+
### Added
10+
- Add tests for PHP 8.1 (memcached is excluded)
11+
- Add GitHub action for Release process
12+
- Add `CHANGELOG.md`
13+
### Changed
14+
- Remove `composer.lock` file
15+
- Use `BouncerException` for some specific errors
16+
### Fixed
17+
- Fix auto-prepend script: set `debug_mode` and `display_errors` values before bouncer init
18+
- Fix `gregwar/captcha` for PHP 8.1
19+
- Fix BouncerException arguments in `set_error_handler` method
20+
821
## [0.14.0] - 2021-11-18
922
### Changed
1023
- Allow older versions of symfony config and monolog

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Constants
2020
public const CAPI_URL = 'https://api.crowdsec.net/v2/';
2121

2222
/** @var string The last version of this library */
23-
public const VERSION = 'v0.14.0';
23+
public const VERSION = 'v0.15.0';
2424

2525
/** @var string The user agent used to send request to LAPI or CAPI */
2626
public const BASE_USER_AGENT = 'PHP CrowdSec Bouncer/'.self::VERSION;

0 commit comments

Comments
 (0)