Skip to content

Commit ff0c775

Browse files
Merge pull request #81 from julienloizelet/feature/77-versionning-vendor
Feature/77 versionning vendor
2 parents cf28c6e + 8f395c1 commit ff0c775

File tree

494 files changed

+58559
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

494 files changed

+58559
-257
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ updates:
33
- package-ecosystem: composer
44
directory: "/"
55
schedule:
6-
interval: weekly
6+
interval: monthly
77
open-pull-requests-limit: 10
88
ignore:
99
- dependency-name: symfony/var-dumper

.github/release-drafter.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/end-to-end-test-suite.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ jobs:
4646
repository: julienloizelet/ddev-wp
4747

4848
- name: Install DDEV
49+
env:
50+
DDEV_VERSION: v1.18.2
4951
run: |
5052
# @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
5153
sudo apt-get -qq update
5254
sudo apt-get -qq -y install libnss3-tools
5355
curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh
54-
bash install_ddev.sh
56+
bash install_ddev.sh ${{ env.DDEV_VERSION }}
5557
ddev config global --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
5658
rm install_ddev.sh
5759
@@ -90,10 +92,6 @@ jobs:
9092
with:
9193
path: my-own-modules/${{ env.EXTENSION_PATH }}
9294

93-
- name: Install ${{ env.EXTENSION_NAME }} with composer dependencies
94-
run: |
95-
ddev composer install --no-dev --prefer-dist --optimize-autoloader --working-dir ./my-own-modules/${{ env.EXTENSION_PATH }}
96-
9795
- name: Prepare for playwright test
9896
run: |
9997
cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Deploy and Create Release
2+
# example: gh workflow run release.yml -f tag_name=v1.1.4 -f deploy_to_wordpress=true
3+
on:
4+
workflow_dispatch:
5+
tag_name:
6+
type: string
7+
required: true
8+
deploy_to_wordpress:
9+
type: boolean
10+
description: Deploy to WordPress
11+
default: true
12+
required: true
13+
14+
jobs:
15+
deploy-create-release:
16+
name: Deploy and create release
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Check naming convention
21+
run: |
22+
VERIF=$(echo ${{ github.event.inputs.tag_name }} | grep -E "^v([0-9]{1,}\.)([0-9]{1,}\.)([0-9]{1,})(-(alpha|beta)\.[0-9]{1,})?$")
23+
if [ ! ${VERIF} ]
24+
then
25+
echo "Tag name '${{ github.event.inputs.tag_name }}' does not comply with naming convention vX.Y.Z"
26+
exit 1
27+
fi
28+
29+
- name: Set version number without v
30+
run: |
31+
echo "VERSION_NUMBER=$(echo ${{ github.event.inputs.tag_name }} | sed 's/v//g' )" >> $GITHUB_ENV
32+
33+
- name: Clone sources
34+
uses: actions/checkout@v2
35+
36+
- name: Check version ${{ env.VERSION_NUMBER }} consistency in files
37+
# Check crowdsec.php, readme.txt, inc/constants.php and CHANGELOG.md
38+
run: |
39+
CURRENT_DATE=$(date +'%Y-%m-%d')
40+
CHANGELOG_VERSION=$(grep -o -E "## \[(.*)\] - $CURRENT_DATE" CHANGELOG.md | head -1 | sed 's/ //g')
41+
echo $CURRENT_DATE
42+
echo $CHANGELOG_VERSION
43+
echo "##[${{ env.VERSION_NUMBER }}]-$CURRENT_DATE"
44+
if [[ $CHANGELOG_VERSION == "##[${{ env.VERSION_NUMBER }}]-$CURRENT_DATE" ]]
45+
then
46+
echo "Version in CHANGELOG.md: OK"
47+
else
48+
echo "Version in CHANGELOG.md: KO"
49+
exit 1
50+
fi
51+
CROWDSEC_VERSION=$(grep -E "Version: (.*)" crowdsec.php | sed 's/ //g')
52+
echo $CROWDSEC_VERSION
53+
echo "*Version:${{ env.VERSION_NUMBER }}"
54+
if [[ $CROWDSEC_VERSION == "*Version:${{ env.VERSION_NUMBER }}" ]]
55+
then
56+
echo "Version in crowdsec.php: OK"
57+
else
58+
echo "Version in crowdsec.php: KO"
59+
exit 1
60+
fi
61+
CROWDSEC_STABLE=$(grep -E "Stable tag: (.*)" crowdsec.php | sed 's/ //g')
62+
echo $CROWDSEC_STABLE
63+
echo "*Stabletag:${{ env.VERSION_NUMBER }}"
64+
if [[ $CROWDSEC_STABLE == "*Stabletag:${{ env.VERSION_NUMBER }}" ]]
65+
then
66+
echo "Stable tag in crowdsec.php: OK"
67+
else
68+
echo "Stable tag in crowdsec.php: KO"
69+
exit 1
70+
fi
71+
README_STABLE=$(grep -E "Stable tag: (.*)" readme.txt | sed 's/ //g')
72+
echo $README_STABLE
73+
echo "Stabletag:${{ env.VERSION_NUMBER }}"
74+
if [[ $README_STABLE == "Stabletag:${{ env.VERSION_NUMBER }}" ]]
75+
then
76+
echo "Stable tag in readme.txt: OK"
77+
else
78+
echo "Stable tag in readme.txt: KO"
79+
exit 1
80+
fi
81+
CONSTANT_VERSION=$(grep -E "WordPress CrowdSec Bouncer/v(.*)" inc/constants.php | sed 's/[\x27(),/ ]//g')
82+
echo $CONSTANT_VERSION
83+
echo "defineCROWDSEC_BOUNCER_USER_AGENTWordPressCrowdSecBouncerv${{ env.VERSION_NUMBER }}"
84+
if [[ $CONSTANT_VERSION == "defineCROWDSEC_BOUNCER_USER_AGENTWordPressCrowdSecBouncerv${{ env.VERSION_NUMBER }};" ]]
85+
then
86+
echo "Version in inc/constants.php: OK"
87+
else
88+
echo "Version in inc/constants.php: KO"
89+
exit 1
90+
fi
91+
92+
- name: Create Tag ${{ github.event.inputs.tag_name }}
93+
uses: actions/github-script@v3
94+
with:
95+
github-token: ${{ github.token }}
96+
script: |
97+
github.git.createRef({
98+
owner: context.repo.owner,
99+
repo: context.repo.repo,
100+
ref: "refs/tags/${{ github.event.inputs.tag_name }}",
101+
sha: context.sha
102+
})
103+
104+
- name: WordPress Plugin Deploy
105+
if: github.event.inputs.deploy_to_wordpress == 'true'
106+
id: deploy
107+
uses: 10up/action-wordpress-plugin-deploy@2.0.0
108+
with:
109+
generate-zip: true
110+
env:
111+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
112+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
113+
SLUG: crowdsec
114+
VERSION: ${{ env.VERSION_NUMBER }}
115+
116+
- name: Prepare release notes
117+
run: |
118+
VERSION_RELEASE_NOTES=$(awk -v ver="[${{ env.VERSION_NUMBER }}]" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p && NF' CHANGELOG.md)
119+
echo "$VERSION_RELEASE_NOTES" >> CHANGELOG.txt
120+
cat CHANGELOG.txt
121+
122+
123+
- name: Create release ${{ env.VERSION_NUMBER }} with Wordpress zip
124+
if: github.event.inputs.deploy_to_wordpress == 'true'
125+
uses: softprops/action-gh-release@v1
126+
with:
127+
files: crowdsec.zip
128+
body_path: CHANGELOG.txt
129+
name: ${{ env.VERSION_NUMBER }}
130+
tag_name: ${{ github.event.inputs.tag_name }}
131+
draft: false
132+
prerelease: false
133+
134+
- name: Create release ${{ env.VERSION_NUMBER }} without Wordpress zip
135+
if: github.event.inputs.deploy_to_wordpress != 'true'
136+
uses: softprops/action-gh-release@v1
137+
with:
138+
body_path: CHANGELOG.txt
139+
name: ${{ env.VERSION_NUMBER }}
140+
tag_name: ${{ github.event.inputs.tag_name }}
141+
draft: false
142+
prerelease: false

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Composer
2-
vendor/
2+
vendor/crowdsec/bouncer/*
3+
!vendor/crowdsec/bouncer/src
4+
!vendor/crowdsec/bouncer/LICENSE
5+
36

47
# Systems
58
.DS_Store
@@ -17,4 +20,4 @@ crowdsec-wp*
1720
*.log
1821
.vagrant
1922
.env
20-
inc/standalone-settings.php
23+
inc/standalone-settings.php

composer.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
"symfony/polyfill-mbstring": "1.20.0",
1919
"symfony/service-contracts": "2.4.1"
2020
},
21-
"require-dev": {
22-
"bramus/monolog-colored-line-formatter": "^3.0",
23-
"symfony/var-dumper": "^5.2"
24-
},
2521
"autoload": {
2622
"psr-4": {
2723
"\\": "./"

0 commit comments

Comments
 (0)