Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{yml,yaml}]
indent_style = space
indent_size = 2
26 changes: 26 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Directories
/.git export-ignore
/.github export-ignore
/node_modules export-ignore
/src export-ignore

# Configuration files
/.distignore export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.plugin-data export-ignore
/.wp-env.json export-ignore
/grumphp.yml export-ignore
/phpcs.xml.dist export-ignore
/psalm.xml.dist export-ignore

# Dependency management
/composer.json export-ignore
/composer.lock export-ignore
/package.json export-ignore
/package-lock.json export-ignore

# Documentation (GitHub)
/CHANGELOG.md export-ignore
/README.md export-ignore
38 changes: 38 additions & 0 deletions .github/workflows/pull-request-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Check plugin version and tags"
on:
pull_request:
branches:
- main

jobs:
version-check:
name: "Check version doesn't not already exists."
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- id: set-vars
name: "Set variables from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"

- id: version-check
name: "Check version in .plugin-data is not existing"
run: |
# Check version from .plugin-data
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}

if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag aleady exists please update the .plugin-data file to good version";
exit 1;
fi
38 changes: 38 additions & 0 deletions .github/workflows/quality-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Javascript Quality Checks

on:
pull_request:
paths:
- 'src/**'
push:
paths:
- 'src/**'
branches:
- main

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
checks:
name: Lint JS
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Install npm dependencies
run: npm ci

- name: Run wp-script lint:js on src folder
run: npm run lint:js src
38 changes: 38 additions & 0 deletions .github/workflows/quality-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHP Quality Checks

on:
pull_request:
push:
branches:
- main

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
checks:
name: Lint PHP
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, intl

- name: Validate composer file
run: composer validate

- name: Install composer dependencies
run: composer install

- name: Run codesniffer
run: composer cs
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Release new TAG"
on:
push:
branches:
- main

jobs:
build-and-release:
name: "Release new TAG"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- id: set-vars
name: "Set variable from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"

- id: check-version
name: "Check version does not exists"
run: |
# Get the version from .plugin-data file.
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}

echo "Get Branch tag"
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag already exists, stop now";
exit 1;
fi

- id: build-php
name: "Build project PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- run: composer install --prefer-dist --no-dev -o --ignore-platform-reqs

- id: setup-node
name: "Setup Node.js"
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- id: build-js
name: "Build JavaScript assets"
run: |
echo "Install npm dependencies"
npm ci
echo "Build assets"
npm run build

- id: commit-and-push
name: "Commit and push new TAG"
run: |
# Get the version from .plugin-data file.
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}

echo "Copy .distignore to .gitignore"
cp .distignore .gitignore

echo "Configure git"
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"

echo "Creating branch"
git checkout -b release/${VERSION}

echo "Creating tag ${VERSION}"
git add .
git add -u
git commit -m "Release version ${VERSION}"
git tag ${VERSION}
git push --tags
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
build/

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of `npm pack`
*.tgz

# Output of `wp-scripts plugin-zip`
*.zip

# dotenv environment variables file
.env
4 changes: 4 additions & 0 deletions .plugin-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "1.0.0",
"slug": "blockparty-modal"
}
5 changes: 5 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
"./"
]
}
Loading
Loading