Skip to content

Instantly share code, notes, and snippets.

@ZachWatkins
Last active April 28, 2022 15:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ZachWatkins/840bc4e2599f7f93474670eb0287b766 to your computer and use it in GitHub Desktop.
Save ZachWatkins/840bc4e2599f7f93474670eb0287b766 to your computer and use it in GitHub Desktop.
Setup WordPress plugin or theme repository for continuous integration service's virtual machine environment
# RECOMMENDED BY WPENGINE
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
# large/disallowed file types
# a CDN should be used for these
*.hqx
*.bin
*.exe
*.dll
*.deb
*.dmg
*.iso
*.img
*.msi
*.msp
*.msm
*.mid
*.midi
*.kar
*.mp3
*.ogg
*.m4a
*.ra
*.3gpp
*.3gp
*.mp4
*.mpeg
*.mpg
*.mov
*.webm
*.flv
*.m4v
*.mng
*.asx
*.asf
*.wmv
*.avi
# Directories that may or may not exist in repo AND should not be on the server
package.json
bower.json
.bower.json
.bowerrc
config.rb
node_modules
.sass-cache
*.md
*.txt
*.ai
*.scss
*.coffee
.gitignore
LICENSE
LICENSE-MIT
gruntfile.js
Gruntfile.js
werker.yml
.editorconfig
css/src
js/src
# Build
composer install
npm install
grunt develop
# Check PHP against WordPress VIP standards
npm run checkwp
{
"name": "agrilife/reponame",
"description": "Description",
"license": "GPL-2.0+",
"authors": [
{
"name": "Zachary Watkins",
"email": "zachary.watkins@ag.tamu.edu"
}
],
"minimum-stability": "stable",
"require": {
},
"require-dev": {
"wp-coding-standards/wpcs": "^1.0"
}
}
# Release
grunt release
# Deploy
git add --all :/
git commit -m "DEPLOYMENT"
git push servers HEAD:refs/heads/master --force
{
"name": "reponame",
"version": "1.0.0",
"description": "description",
"main": "functions.php",
"scripts": {
"start": "composer install && npm install && grunt",
"checkwp": "npm run configphpcs && npm run checkphp",
"configphpcs": "vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs && vendor/bin/phpcs --config-set ignore_errors_on_exit 1 && vendor/bin/phpcs --config-set ignore_warnings_on_exit 1",
"checkphp": "vendor/bin/phpcs --standard=WordPress --report=source ./*.php ./src && vendor/bin/phpcs --standard=WordPress ./*.php ./src"
},
"author": "Zachary Watkins",
"license": "GPL-2.0+",
"bugs": {
"url": "https://github.com/agrilife/reponame/issues",
"email": "first-call@tamu.edu"
},
"dependencies": {
"autoprefixer": "^9.1.5",
"foundation-sites": "^6.x",
"grunt": "^1.0.3",
"grunt-contrib-coffee": "^2.0.0",
"grunt-contrib-compress": "^1.4.3",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-sass": "^1.0.0",
"grunt-postcss": "^0.9.0",
"jquery": "^3.3.1",
"underscore": "^1.9.1",
"what-input": "^5.1.2"
},
"devDependencies": {
"grunt-contrib-watch": "^1.1.0",
"grunt-jsvalidate": "^0.2.2",
"grunt-sass-lint": "^0.2.4"
},
"engines": {
"node": ">=6.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/agrilife/reponame.git"
},
"homepage": "https://github.com/agrilife/reponame#readme"
}
# Get around shallow update restriction
if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi
# Add User Data
git config --global user.name "codeship-shortreponame"
git config --global user.email "youremail@email.com"
git config --global github.token RELEASE_KEY
# Combine remote git servers
git remote add servers $SERVERNAME_ENVIRONMENT
git remote set-url --add --push servers $SERVERNAME_ENVIRONMENT
git remote set-url --add --push servers $SERVERNAME2_ENVIRONMENT
# Install needed modules
rvm use 2.2.6 --install
npm install -g sass
# Move repo files to a named folder
mkdir $FOLDERNAME
shopt -s extglob
mv !($FOLDERNAME) $FOLDERNAME
# Move repo files whose name begins with a period
mv .sass-lint.yml $FOLDERNAME/.sass-lint.yml
# Exclude development-only files from commit
rm .gitignore
mv .codeshipignore $FOLDERNAME/.gitignore
# Move named folder into a structure identical to the root directory of a WordPress server
mkdir -p $DIRECTORY
mv $FOLDERNAME $DIRECTORY
cd $DIRECTORY/$FOLDERNAME/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment