Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
al-esc authored May 29, 2024
0 parents commit 21a3ecb
Show file tree
Hide file tree
Showing 17 changed files with 10,166 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
feature: ['feature/*', 'feat/*']
fix: ['fix/*', 'bug/*']
chore: ['chore/*', 'misc/*']
documentation: ['doc/*', 'docs/*']
39 changes: 39 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- 'feature request'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
- title: '📖 Documentation'
labels:
- 'documentation'
- 'docs'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## [v$RESOLVED_VERSION(####-##-##)](https://github.com/al-esc/tips/compare/$PREVIOUS_TAG...$RESOLVED_VERSION)
$CHANGES
---
Released with ❤️ by: $CONTRIBUTORS
14 changes: 14 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PR Labeler
on:
pull_request:
types: [opened]

jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v3
with:
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/release-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build release artifact

on:
release:
types: [released]

env:
EXCLUDES: ${{ '"**/node_modules/*" "**/assets/*" "**/*.md" "**/.git/*" "**/.github/*" "**/.gitignore" "**/composer.lock" "**/composer.json" "**/package.json" "**/package-lock.json" "**/phpcs.xml" "**/webpack.mix.js" "**/.eslintrc" "**/phpunit.xml.dist" "**/bin/*" "**/tests/*"' }}

jobs:
build_artifact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set repo name environment variable
id: set-repo-variable
run: echo "REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f 2)" >> $GITHUB_ENV
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::vendor"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install PHP dependencies
id: composer-install
run: composer install --no-dev
- name: Dump autoload files
id: composer-dump
run: composer dump-autoload -o
- name: Get NPM Cache Directory
id: npm-cache
run: |
echo "::set-output name=dir::node_modules"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
check-latest: true
- name: Install NPM dependencies
id: npm-install
run: npm install
- name: Build production assets
id: npm-build
run: npm run prod
- name: Build artifact
id: build-artifact
env:
ZIP: ${{ env.REPO }}.zip
DIR: ${{ env.REPO }}
run: cd .. && zip -r ${{ env.ZIP }} ${{ env.DIR }} -x ${{ env.EXCLUDES }}
- name: Upload artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ../${{ env.REPO }}.zip
asset_name: ${{ env.REPO }}.zip
asset_content_type: application/zip
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- primary
- develop

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
with:
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
vendor/
dist/
.DS_Store
*.code-workspace
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h3 align="center">WordPress Plugin Template</h3>
<h4>Included:</h4>

- OOP architecture

- Build pipeline

- PSR-4 Autoloading

- GitHub workflows for:

- Building release asset

- PR labeler

- Release drafter
85 changes: 85 additions & 0 deletions app/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

/**
* The plugin first class.
*
* @package crowdfavorite\tips
*/

namespace Tips;

/**
* The main class
*/
class Plugin
{

/**
* Class instance.
*
* @access private
* @static
*
* @var Main
*/
private static $instance;

/**
* Get instance of the class.
*
* @access public
* @static
*
* @return Main
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}

return self::$instance;
}

/**
* The main class construct.
*/
public function __construct()
{
$this->init();
}

/**
* Initialize the plugin.
*/
private function init()
{
add_action(
'admin_enqueue_scripts',
[$this, 'enqueueAssets']
);
}

/**
* `wp_enqueue_scripts` hook.
*
* @return void
*/
public function enqueueAssets()
{
wp_enqueue_script(
TIPS_HANDLE,
TIPS_PLUGIN_DIR_URL . 'dist/app.js',
[],
filemtime(TIPS_PLUGIN_DIR . 'dist/app.js'),
true
);

wp_enqueue_style(
TIPS_HANDLE,
TIPS_PLUGIN_DIR_URL . 'dist/app.css',
[],
filemtime(TIPS_PLUGIN_DIR . 'dist/app.css')
);
}
}
Empty file added assets/js/app.js
Empty file.
Empty file added assets/scss/app.scss
Empty file.
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "crowdfavorite/tips",
"type": "wordpress-plugin",
"description": "TIPS is plugin scaffolding",
"keywords": [
"wordpress",
"plugin"
],
"support": {
"email": "[email protected]"
},
"authors": [
{
"name": "Al Esc",
"email": "[email protected]",
"homepage": "https://crowfavorite.com"
}
],
"autoload": {
"psr-4": {
"Tips\\": "app/"
}
},
"require": {
"php": ">=7.0.0"
}
}
20 changes: 20 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 21a3ecb

Please sign in to comment.