|
1 | 1 | .PHONY:
|
2 | 2 | build:
|
3 | 3 | make clean
|
4 |
| - git clone --depth=1 --branch=`git branch --contains |cut -d " " -f 2` https://github.com/uzulla/fc2blog.git fc2blog |
| 4 | + git clone --depth=1 --branch=`git branch --contains |cut -d " " -f 2| sed '/^$/d'` https://github.com/uzulla/fc2blog.git fc2blog |
5 | 5 | rm -rf fc2blog/.git
|
6 | 6 | cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader
|
7 |
| - cd fc2blog && zip -r ../fc2blog_dist_`git rev-parse --short HEAD`.zip app public |
| 7 | + # get tag from current commit id. |
| 8 | + git tag -l --contains `git show -s --format=%H` > fc2blog/app/version |
| 9 | + # Set "dev" to contents/version, If contents/version is zero size file. |
| 10 | + if [ ! -s fc2blog/app/version ]; then echo "dev:"`git branch --contains |cut -d " " -f 2 | grep -e '.'`":"`git rev-parse --short HEAD` > fc2blog/app/version; fi |
| 11 | + cd fc2blog && zip -r ../fc2blog_dist.zip app public |
| 12 | + |
| 13 | +.PHONY: |
| 14 | +build-no-pushed-branch: |
| 15 | + make clean |
| 16 | + mkdir fc2blog |
| 17 | + cp -a ../app ../public ../composer.json ../composer.lock fc2blog |
| 18 | + -rm fc2blog/app/temp/installed.lock |
| 19 | + cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader |
| 20 | + rm fc2blog/composer.* |
| 21 | + echo "dev:"`git branch --contains |cut -d " " -f 2 | grep -e '.'`":"`git rev-parse --short HEAD` > fc2blog/app/version |
| 22 | + cd fc2blog && zip -r ../fc2blog_dist.zip app public |
8 | 23 |
|
9 | 24 | .PHONY:
|
10 | 25 | clean:
|
11 | 26 | -rm -rf fc2blog
|
12 |
| - -rm fc2blog_dist_* |
| 27 | + -rm fc2blog_dist.zip |
13 | 28 | -rm test_vm/fc2blog_dist.zip
|
14 | 29 | -rm test_vm/fc2blog_installer.php
|
15 | 30 |
|
16 | 31 | .PHONY:
|
17 | 32 | test:
|
18 | 33 | make build
|
19 |
| - cp fc2blog_dist_`git -C fc2blog rev-parse --short HEAD`.zip test_vm/fc2blog_dist.zip |
| 34 | + cp fc2blog_dist.zip test_vm/fc2blog_dist.zip |
| 35 | + cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php |
| 36 | + cd test_vm && make image && make bash |
| 37 | + |
| 38 | +.PHONY: |
| 39 | +test-no-pushed-branch: |
| 40 | + make build-no-pushed-branch |
| 41 | + cp fc2blog_dist.zip test_vm/fc2blog_dist.zip |
20 | 42 | cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php
|
21 | 43 | cd test_vm && make image && make bash
|
0 commit comments