Skip to content

Commit

Permalink
new: split packages. #5
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunthegeek committed May 28, 2019
1 parent 4d43a15 commit 5cfa672
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ jobs: # a collection of steps
- add_ssh_keys:
fingerprints:
- "8d:4d:a0:2f:19:d2:d9:8c:ed:83:2c:20:bc:aa:32:f0"
- run:
name: Install subsplit
command: |
sudo wget -O "$(git --exec-path)"/git-subsplit https://raw.githubusercontent.com/dflydev/git-subsplit/master/git-subsplit.sh
sudo chmod +x "$(git --exec-path)"/git-subsplit
- run:
name: auto split packages, push code and tag to new repo. but need submit to packagist.org manually, because it have no API to submit.
command: ./split-packages.sh
- run:
name: Deploy docs to gh-pages branch
command: gh-pages --dotfiles --message "[skip ci] Updates" --dist site
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
/mkdocs.yml
/docs/
/site/
/.subsplit/
34 changes: 34 additions & 0 deletions split-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

rm -rf .subsplit
git subsplit init `git config --get remote.origin.url`
git subsplit update
for file in `ls */composer.json`; do
target=`node getValueFromJsonFile.js $file extra.component.target`
repo_uri=`echo $target | cut -d "." -f1`
desc=`node getValueFromJsonFile.js $file description`
dir_name=`dirname $file`
hub create -d "$desc" $repo_uri
git subsplit publish \
$dir_name:[email protected]:$target \
--heads=master \
--no-tags

# create tag
echo -e "\ncreate tag"
version=`node getValueFromJsonFile.js $file version`
repo_name=`echo $repo_uri | cut -d "/" -f2`
rm -rf /tmp/$repo_name
pushd /tmp/
git clone [email protected]:$target
pushd /tmp/$repo_name
tag_exists=`git ls-remote origin refs/tags/$version`
if [ -z $tag_exists ]; then
git tag -a $version -m 'new version'
git push --tags
fi
pushd +2
dirs -c
dirs -v
done

0 comments on commit 5cfa672

Please sign in to comment.