-
Notifications
You must be signed in to change notification settings - Fork 260
/
Makefile
48 lines (39 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.PHONY: docker build
include artifacts/Makefile
# Run unit tests
test:
./vendor/bin/phpunit -c phpunit.xml.dist
# Codesniffer check
phpcs:
./vendor/bin/phpcs src/ tests/ --extensions=php -n
# Codesniffer fix
phpcbf:
./vendor/bin/phpcbf src/ tests/ --extensions=php -n
# Used for tag releasing
# Don't use directly, use `make release` instead
tag:
@semver inc $(VERSION)
@echo "New release: `semver tag`"
@echo Releasing sources
@sed -i -r "s/(v[0-9]+\.[0-9]+\.[0-9]+)/`semver tag`/g" \
.github/ISSUE_TEMPLATE/Bug_report.md \
.github/ISSUE_TEMPLATE/Feature_request.md \
src/functions.php \
artifacts/debian/control \
artifacts/bintray.json \
doc/installation.md
@sed -i -r "s/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/`date +%Y-%m-%d`/g" artifacts/bintray.json
@make changelog-deb
# Tag git with last release
new_git_version: build tag
git add .semver .github/ISSUE_TEMPLATE/Bug_report.md .github/ISSUE_TEMPLATE/Feature_request.md src/functions.php doc/installation.md artifacts/* releases/*
git commit -m "releasing `semver tag`"
git tag `semver tag` -m "releasing `semver tag`"
git push -u origin master
git push origin `semver tag`
docker:
docker build -t phpmetrics/releasing ./docker/releasing
# Publish new release. Usage:
# make tag VERSION=(major|minor|patch)
release: docker
docker run -it --rm --mount type=bind,source=$$SSH_AUTH_SOCK,target=/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent -v ~/.gitconfig:/etc/gitconfig -v $(PWD):/app -w /app phpmetrics/releasing make new_git_version VERSION=$(VERSION)