Skip to content

Commit 1712565

Browse files
committed
Way to release via docker
1 parent 77a011b commit 1712565

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.PHONY: docker build
2+
13
include artifacts/Makefile
24

35
# Run unit tests
@@ -12,9 +14,8 @@ phpcs:
1214
phpcbf:
1315
./vendor/bin/phpcbf src/ tests/ --extensions=php -n
1416

15-
# Publish new release. Usage:
16-
# make tag VERSION=(major|minor|patch)
17-
# You need to install https://github.com/flazz/semver/ before
17+
# Used for tag releasing
18+
# Don't use directly, use `make release` instead
1819
tag:
1920
@semver inc $(VERSION)
2021
@echo "New release: `semver tag`"
@@ -31,9 +32,17 @@ tag:
3132

3233

3334
# Tag git with last release
34-
release: build
35+
new_git_version: build tag
3536
git add .semver .github/ISSUE_TEMPLATE/Bug_report.md .github/ISSUE_TEMPLATE/Feature_request.md src/functions.php doc/installation.md artifacts/* releases/*
36-
git commit -S -m "releasing `semver tag`"
37-
git tag -s `semver tag`
37+
git commit -m "releasing `semver tag`"
38+
git tag `semver tag` -m "releasing `semver tag`"
3839
git push -u origin master
3940
git push origin `semver tag`
41+
42+
docker:
43+
docker build -t phpmetrics/releasing ./docker/releasing
44+
45+
# Publish new release. Usage:
46+
# make tag VERSION=(major|minor|patch)
47+
release: docker
48+
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)

doc/contributing.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ Please NEVER tag manually.
1717

1818
### Requirements
1919

20-
+ You will need to install `semver`
20+
You will need to install :
2121

22-
gem install semver
23-
24-
+ Please disable `phar.readonly` in your `php.ini` file
25-
26-
### Usage
22+
+ [`docker`](https://www.docker.com/)
23+
+ [make](https://www.gnu.org/software/make/)
2724

28-
Git must configure a GPG key on your Github account to verify commits.
25+
### Usage
2926

30-
These commands will create phar, debian and binary release,
31-
then run all tests and push new release to Github :
27+
These commands will create `phar`, `debian` and `binary` release,
28+
then run all tests and push new release to Github:
3229

33-
make tag VERSION=<VERSION>
34-
# <VERSION> can be `major`, `minor` or `patch`
35-
make release
30+
```bash
31+
make release VERSION=<VERSION>
32+
# <VERSION> can be `major`, `minor` or `patch`
33+
```

docker/releasing/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM composer/composer:2-bin AS composer
2+
3+
# please do not use alpine here: We need a debian based image for .deb distribution
4+
FROM php:7.4-cli-bullseye
5+
6+
# Installing ruby, semver and required dependencies
7+
RUN apt update \
8+
&& apt install -y ruby ruby-dev make build-essential git gnupg2 debhelper \
9+
&& gem install semver \
10+
&& echo "phar.readonly=0" > /usr/local/etc/php/conf.d/phar.ini
11+
12+
RUN git config --global --add safe.directory /app
13+
14+
# Installing composer
15+
ENV COMPOSER_ALLOW_SUPERUSER=1
16+
ENV PATH="${PATH}:/root/.composer/vendor/bin"
17+
COPY --from=composer /composer /usr/bin/composer

0 commit comments

Comments
 (0)