Skip to content

Commit ebba53e

Browse files
committed
add versionning process
1 parent 70641e1 commit ebba53e

File tree

4 files changed

+67
-3
lines changed

4 files changed

+67
-3
lines changed

crowdsec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
Plugin URI: https://www.crowdsec.net/
55
Description: Safer Together. Protect your WordPress application with CrowdSec.
66
Tags: security, firewall, malware scanner, two factor authentication, captcha, waf, web app firewall, mfa, 2fa
7-
Version 0.0.1
7+
Version 0.1.0
88
Author: CrowdSec
99
Author URI: https://www.crowdsec.net/
1010
Github: https://github.com/crowdsecurity/cs-wordpress-blocker
1111
License: MIT
1212
Requires PHP: 7.2
13-
Stable tag: 0.0.1
13+
Stable tag: 0.1.0
1414
Text Domain: crowdsec-wp
1515
*/
1616

docs/contribute.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,29 @@ docker-compose down
8080
docker images | grep wordpress-bouncer_web # to get the container id
8181
docker rmi 145c1ed0e4df
8282
CS_WORDPRESS_BOUNCER_PHP_VERSION=7.2 docker-compose up -d --build --force-recreate
83+
```
84+
85+
#### New feature
86+
87+
```bash
88+
git checkout -b <branch-name>
89+
git commit # as much as necessary.
90+
91+
# Rename branch if necessary
92+
git branch -m <new-name>
93+
git push origin :<old-name> && git push origin <new-name>
94+
95+
# Create PR
96+
gh pr create --fill
97+
```
98+
99+
After the merge, don't forget to delete to branch.
100+
101+
#### New release
102+
103+
```bash
104+
git checkout main && git pull
105+
git describe --tags `git rev-list --tags --max-count=1` # to verify what is the current tag
106+
export NEW_GIT_VERSION_WITHOUT_V_PREFIX= #...X.X.X
107+
./scripts/publish-release.sh
83108
```

inc/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
define('CROWDSEC_CAPTCHA_TECHNOLOGY_LOCAL', "local");
1616
define('CROWDSEC_CAPTCHA_TECHNOLOGY_RECAPTCHA', "recaptcha");
1717

18-
define('CROWDSEC_BOUNCER_USER_AGENT', "Wordpress CrowdSec Bouncer/0.0.1");
18+
define('CROWDSEC_BOUNCER_USER_AGENT', "Wordpress CrowdSec Bouncer/v0.1.0");

scripts/publish-release.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Check state.
4+
if [ -z "${NEW_GIT_VERSION_WITHOUT_V_PREFIX}" ]; then
5+
echo "No \$NEW_GIT_VERSION_WITHOUT_V_PREFIX env var found. Exiting."
6+
exit 1
7+
fi
8+
9+
# Initilize
10+
platform='unknown'
11+
unamestr=`uname`
12+
if [[ "$unamestr" == 'Linux' ]]; then
13+
platform='linux'
14+
elif [[ "$unamestr" == 'FreeBSD' ]]; then
15+
platform='freebsd'
16+
elif [[ "$unamestr" == 'Darwin' ]]; then
17+
platform='osx'
18+
fi
19+
git_base_dir=`git rev-parse --show-toplevel`
20+
21+
# Update version everywhere (add and commit changes)
22+
if [[ $platform == 'linux' ]]; then
23+
sed -i -E "s/Version [0-9]+\.[0-9]+\.[0-9]/Version $NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/crowdsec.php
24+
sed -i -E "s/Stable tag: [0-9]+\.[0-9]+\.[0-9]/Stable tag: $NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/crowdsec.php
25+
sed -i -E "s/v[0-9]+\.[0-9]+\.[0-9]/v$NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/inc/constants.php
26+
else
27+
sed -i "" -E "s/Version [0-9]+\.[0-9]+\.[0-9]/Version $NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/crowdsec.php
28+
sed -i "" -E "s/Stable tag: [0-9]+\.[0-9]+\.[0-9]/Stable tag: $NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/crowdsec.php
29+
sed -i "" -E "s/v[0-9]+\.[0-9]+\.[0-9]/v$NEW_GIT_VERSION_WITHOUT_V_PREFIX/" `git rev-parse --show-toplevel`/inc/constants.php
30+
fi
31+
git add `git rev-parse --show-toplevel`/inc/constants.php
32+
git add `git rev-parse --show-toplevel`/crowdsec.php
33+
git commit -m "bump version to v$NEW_GIT_VERSION_WITHOUT_V_PREFIX"
34+
echo "Note: new commit \"bump version to v$NEW_GIT_VERSION_WITHOUT_V_PREFIX\""
35+
36+
# Tag and release
37+
git tag v$NEW_GIT_VERSION_WITHOUT_V_PREFIX
38+
git push origin v$NEW_GIT_VERSION_WITHOUT_V_PREFIX
39+
gh release create --draft v$NEW_GIT_VERSION_WITHOUT_V_PREFIX --title v$NEW_GIT_VERSION_WITHOUT_V_PREFIX

0 commit comments

Comments
 (0)