Skip to content

Instantly share code, notes, and snippets.

@fumikito
Last active June 2, 2017 04:37
Show Gist options
  • Select an option

  • Save fumikito/2ea8da2a39cb4a59bf0a1bfd977f0377 to your computer and use it in GitHub Desktop.

Select an option

Save fumikito/2ea8da2a39cb4a59bf0a1bfd977f0377 to your computer and use it in GitHub Desktop.
deploy-plugin
#! /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
@fumikito

fumikito commented Jun 2, 2017

Copy link
Copy Markdown
Author

Github上のプラグインをzipパッケージにするときに使います。 Gumroadなどにあげるときに使っています。

deploy-plugin fumikito gianism 3.0.5
  • Macでのみ動作確認(ホームディレクトリにDownloadsフォルダ必須)
  • readme.txt は readme.md より生成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment