Last active
June 2, 2017 04:37
-
-
Save fumikito/2ea8da2a39cb4a59bf0a1bfd977f0377 to your computer and use it in GitHub Desktop.
deploy-plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env bash | |
| set -e | |
| echo "Compiling $1/$2..." | |
| cd ~/Downloads | |
| mkdir tmp | |
| cd tmp | |
| git clone git@github.com:$1/$2.git | |
| cd $2 | |
| # Set branch | |
| BRANCH=master | |
| # checkout Tag | |
| if [ $# = 3 ]; then | |
| git checkout refs/tags/$3 | |
| BRANCH=$3 | |
| echo "Checking out tag@$3..." | |
| fi | |
| # Install libraries | |
| if [ -e package.json ]; then | |
| npm install && npm run package | |
| fi | |
| if [ -e composer.json ]; then | |
| composer install --no-dev | |
| fi | |
| # Erase files | |
| dirs=(.git bower_components src node_modules .gitignore tests .travis.yml phpcs.ruleset.xml phpunit.xml.dist) | |
| for dir in ${dirs[@]}; do | |
| echo "Remove $dir" | |
| rm -rf $dir | |
| done | |
| curl -L https://raw.githubusercontent.com/fumikito/wp-readme/master/wp-readme.php | php | |
| # compile | |
| cd .. | |
| zip -r $2-$BRANCH.zip $2 | |
| mv $2-$BRANCH.zip ~/Downloads/ | |
| rm -rf ~/Downloads/tmp | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github上のプラグインをzipパッケージにするときに使います。 Gumroadなどにあげるときに使っています。