Skip to content

Commit

Permalink
Improve make dist zip task fc2blog#39 fc2blog#233
Browse files Browse the repository at this point in the history
- Change create filename, remove commit id from filename.
- Generate and add `app/version` file.
- Add build/test-no-pushed-branch task that not be require pushed branch when build.
  • Loading branch information
uzulla committed Mar 14, 2021
1 parent 72168ea commit e1c3553
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions dist_zip/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
.PHONY:
build:
make clean
git clone --depth=1 --branch=`git branch --contains |cut -d " " -f 2` https://github.com/uzulla/fc2blog.git fc2blog
git clone --depth=1 --branch=`git branch --contains |cut -d " " -f 2| sed '/^$/d'` https://github.com/uzulla/fc2blog.git fc2blog
rm -rf fc2blog/.git
cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader
cd fc2blog && zip -r ../fc2blog_dist_`git rev-parse --short HEAD`.zip app public
# get tag from current commit id.
git tag -l --contains `git show -s --format=%H` > fc2blog/app/version
# Set "dev" to contents/version, If contents/version is zero size file.
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
cd fc2blog && zip -r ../fc2blog_dist.zip app public

.PHONY:
build-no-pushed-branch:
make clean
mkdir fc2blog
cp -a ../app ../public ../composer.json ../composer.lock fc2blog
-rm fc2blog/app/temp/installed.lock
cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader
rm fc2blog/composer.*
echo "dev:"`git branch --contains |cut -d " " -f 2 | grep -e '.'`":"`git rev-parse --short HEAD` > fc2blog/app/version
cd fc2blog && zip -r ../fc2blog_dist.zip app public

.PHONY:
clean:
-rm -rf fc2blog
-rm fc2blog_dist_*
-rm fc2blog_dist.zip
-rm test_vm/fc2blog_dist.zip
-rm test_vm/fc2blog_installer.php

.PHONY:
test:
make build
cp fc2blog_dist_`git -C fc2blog rev-parse --short HEAD`.zip test_vm/fc2blog_dist.zip
cp fc2blog_dist.zip test_vm/fc2blog_dist.zip
cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php
cd test_vm && make image && make bash

.PHONY:
test-no-pushed-branch:
make build-no-pushed-branch
cp fc2blog_dist.zip test_vm/fc2blog_dist.zip
cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php
cd test_vm && make image && make bash

0 comments on commit e1c3553

Please sign in to comment.