Skip to content

Commit 07b8273

Browse files
authored
Merge pull request #2 from BeAPI/ver/1.0.0
feat: initial commit
2 parents 28bb044 + f7ea7f1 commit 07b8273

31 files changed

Lines changed: 40344 additions & 0 deletions

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[*.{yml,yaml}]
17+
indent_style = space
18+
indent_size = 2

.gitattributes

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Directories
2+
/.git export-ignore
3+
/.github export-ignore
4+
/node_modules export-ignore
5+
/src export-ignore
6+
7+
# Configuration files
8+
/.distignore export-ignore
9+
/.editorconfig export-ignore
10+
/.gitattributes export-ignore
11+
/.gitignore export-ignore
12+
/.plugin-data export-ignore
13+
/.wp-env.json export-ignore
14+
/grumphp.yml export-ignore
15+
/phpcs.xml.dist export-ignore
16+
/psalm.xml.dist export-ignore
17+
18+
# Dependency management
19+
/composer.json export-ignore
20+
/composer.lock export-ignore
21+
/package.json export-ignore
22+
/package-lock.json export-ignore
23+
24+
# Documentation (GitHub)
25+
/CHANGELOG.md export-ignore
26+
/README.md export-ignore
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Check plugin version and tags"
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
version-check:
9+
name: "Check version doesn't not already exists."
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- id: set-vars
18+
name: "Set variables from .plugin-data file"
19+
run: |
20+
# Get all data from .plugin-data file
21+
content=`cat ./.plugin-data`
22+
# the following lines are only required for multi line json
23+
content="${content//'%'/'%25'}"
24+
content="${content//$'\n'/'%0A'}"
25+
content="${content//$'\r'/'%0D'}"
26+
# end of optional handling for multi line json
27+
echo "::set-output name=pluginData::$content"
28+
29+
- id: version-check
30+
name: "Check version in .plugin-data is not existing"
31+
run: |
32+
# Check version from .plugin-data
33+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
34+
35+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
36+
echo "Tag aleady exists please update the .plugin-data file to good version";
37+
exit 1;
38+
fi

.github/workflows/quality-js.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Javascript Quality Checks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'src/**'
7+
push:
8+
paths:
9+
- 'src/**'
10+
branches:
11+
- main
12+
13+
# Cancels all previous workflow runs for pull requests that have not completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name for pull requests
16+
# or the commit hash for any other events.
17+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
checks:
22+
name: Lint JS
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout project
27+
uses: actions/checkout@v3
28+
29+
- name: Setup NodeJS
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version-file: 'package.json'
33+
34+
- name: Install npm dependencies
35+
run: npm ci
36+
37+
- name: Run wp-script lint:js on src folder
38+
run: npm run lint:js src

.github/workflows/quality-php.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PHP Quality Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
# Cancels all previous workflow runs for pull requests that have not completed.
10+
concurrency:
11+
# The concurrency group contains the workflow name and the branch name for pull requests
12+
# or the commit hash for any other events.
13+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
checks:
18+
name: Lint PHP
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout project
23+
uses: actions/checkout@v3
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 8.1
29+
extensions: mbstring, intl
30+
31+
- name: Validate composer file
32+
run: composer validate
33+
34+
- name: Install composer dependencies
35+
run: composer install
36+
37+
- name: Run codesniffer
38+
run: composer cs

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: "Release new TAG"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-and-release:
9+
name: "Release new TAG"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- id: set-vars
18+
name: "Set variable from .plugin-data file"
19+
run: |
20+
# Get all data from .plugin-data file
21+
content=`cat ./.plugin-data`
22+
# the following lines are only required for multi line json
23+
content="${content//'%'/'%25'}"
24+
content="${content//$'\n'/'%0A'}"
25+
content="${content//$'\r'/'%0D'}"
26+
# end of optional handling for multi line json
27+
echo "::set-output name=pluginData::$content"
28+
29+
- id: check-version
30+
name: "Check version does not exists"
31+
run: |
32+
# Get the version from .plugin-data file.
33+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
34+
35+
echo "Get Branch tag"
36+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
37+
echo "Tag already exists, stop now";
38+
exit 1;
39+
fi
40+
41+
- id: build-php
42+
name: "Build project PHP"
43+
uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: 8.3
46+
- run: composer install --prefer-dist --no-dev -o --ignore-platform-reqs
47+
48+
- id: setup-node
49+
name: "Setup Node.js"
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '20'
53+
cache: 'npm'
54+
55+
- id: build-js
56+
name: "Build JavaScript assets"
57+
run: |
58+
echo "Install npm dependencies"
59+
npm ci
60+
echo "Build assets"
61+
npm run build
62+
63+
- id: commit-and-push
64+
name: "Commit and push new TAG"
65+
run: |
66+
# Get the version from .plugin-data file.
67+
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
68+
69+
echo "Copy .distignore to .gitignore"
70+
cp .distignore .gitignore
71+
72+
echo "Configure git"
73+
git config --local user.email "$(git log --format='%ae' HEAD^!)"
74+
git config --local user.name "$(git log --format='%an' HEAD^!)"
75+
76+
echo "Creating branch"
77+
git checkout -b release/${VERSION}
78+
79+
echo "Creating tag ${VERSION}"
80+
git add .
81+
git add -u
82+
git commit -m "Release version ${VERSION}"
83+
git tag ${VERSION}
84+
git push --tags

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Coverage directory used by tools like istanbul
9+
coverage
10+
11+
# Compiled binary addons (https://nodejs.org/api/addons.html)
12+
build/Release
13+
build/
14+
15+
# Dependency directories
16+
node_modules/
17+
18+
# Optional npm cache directory
19+
.npm
20+
21+
# Optional eslint cache
22+
.eslintcache
23+
24+
# Output of `npm pack`
25+
*.tgz
26+
27+
# Output of `wp-scripts plugin-zip`
28+
*.zip
29+
30+
# dotenv environment variables file
31+
.env

.plugin-data

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.0.0",
3+
"slug": "blockparty-modal"
4+
}

.wp-env.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
"./"
4+
]
5+
}

0 commit comments

Comments
 (0)