Skip to content

Commit 5ef91da

Browse files
committed
CI: Prepare push conditions
1 parent f59dd5b commit 5ef91da

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

.github/workflows/images.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,29 @@ jobs:
4242
run: |
4343
env
4444
45+
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
4546
- name: Show GitHub variables
4647
run: |
4748
echo "github.actor: ${{ github.actor }}"
4849
echo "github.ref: ${{ github.ref }}"
50+
echo "github.base_ref: ${{ github.base_ref }}"
51+
echo "github.head_ref: ${{ github.head_ref }}"
4952
echo "github.event: ${{ github.event }}"
5053
echo "github.event_name: ${{ github.event_name }}"
5154
echo "github.event.pull_request.base.repo.id: ${{ github.event.pull_request.base.repo.id }}"
5255
echo "github.event.pull_request.head.repo.id: ${{ github.event.pull_request.head.repo.id }}"
5356
57+
- name: Dump GitHub context
58+
env:
59+
GITHUB_CONTEXT: ${{ toJson(github) }}
60+
run: echo "${GITHUB_CONTEXT}"
61+
62+
- name: Dump Runner context
63+
env:
64+
RUNNER_CONTEXT: ${{ toJson(runner) }}
65+
run: echo "${RUNNER_CONTEXT}"
66+
67+
5468
build:
5569
name: "[ ${{ matrix.version }} ]"
5670
runs-on: ubuntu-latest
@@ -246,5 +260,29 @@ jobs:
246260
# Only run this, if the PR was created by the repo owner
247261
- name: Publish images (only repo owner)
248262
run: |
263+
# Set branch or tag as slug
264+
if [[ ${GITHUB_REF} =~ ^refs\/tags\/ ]]; then
265+
GIT_TYPE=TAG
266+
GIT_SLUG="${GITHUB_REF/refs\/tags\//}"
267+
else
268+
GIT_TYPE=BRANCH
269+
if [ -n "${GITHUB_HEAD_REF}" ]; then
270+
GIT_SLUG="${GITHUB_HEAD_REF}"
271+
else
272+
GIT_SLUG="${GITHUB_REF/refs\/head\//}"
273+
fi
274+
fi
275+
276+
echo "Git Type: ${GIT_TYPE}"
277+
echo "Git Slug: ${GIT_SLUG}"
278+
249279
echo "Todo: Push to Dockerhub"
250-
if: (github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id || github.ref == 'refs/heads/master')
280+
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
281+
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
282+
&& (
283+
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
284+
||
285+
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
286+
||
287+
(github.event_name == 'pull_request' && (startsWith(github.head_ref, 'release-')))
288+
)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# PHP-FPM Docker images
22

3+
[![PHP](https://github.com/devilbox/docker-php-fpm/workflows/linting/badge.svg)](https://github.com/devilbox/docker-php-fpm/actions?workflow=linting)
4+
[![Linting](https://github.com/devilbox/docker-php-fpm/workflows/PHP/badge.svg)](https://github.com/devilbox/docker-php-fpm/actions?workflow=PHP)
35
[![Build Status](https://travis-ci.org/devilbox/docker-php-fpm.svg?branch=master)](https://travis-ci.org/devilbox/docker-php-fpm)
46
[![Release](https://img.shields.io/github/release/devilbox/docker-php-fpm.svg?colorB=orange)](https://github.com/devilbox/docker-php-fpm/releases)
57
[![Gitter](https://badges.gitter.im/devilbox/Lobby.svg)](https://gitter.im/devilbox/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
68
[![Discourse](https://img.shields.io/discourse/https/devilbox.discourse.group/status.svg?colorB=%234CB697)](https://devilbox.discourse.group)
79
[![License](https://img.shields.io/badge/license-MIT-%233DA639.svg)](https://opensource.org/licenses/MIT)
810

11+
912
This repository will provide you fully functional PHP-FPM Docker images in different flavours,
1013
versions and packed with different types of integrated PHP modules. It also solves the problem of **[syncronizing file permissions](#unsynchronized-permissions)** of mounted volumes between the host and the container.
1114

@@ -1234,6 +1237,8 @@ $ docker exec -it php mysqldump-secure
12341237

12351238
<h2><img id="automated-builds" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Automated builds</h2>
12361239

1240+
[![PHP](https://github.com/devilbox/docker-php-fpm/workflows/linting/badge.svg)](https://github.com/devilbox/docker-php-fpm/actions?workflow=linting)
1241+
[![Linting](https://github.com/devilbox/docker-php-fpm/workflows/PHP/badge.svg)](https://github.com/devilbox/docker-php-fpm/actions?workflow=PHP)
12371242
[![Build Status](https://travis-ci.org/devilbox/docker-php-fpm.svg?branch=master)](https://travis-ci.org/devilbox/docker-php-fpm)
12381243

12391244
Docker images are built and tested every night by **[travis-ci](https://travis-ci.org/devilbox/docker-php-fpm)** and pushed to **[Docker hub](https://hub.docker.com/r/devilbox/php-fpm/)** on success. This is all done automatically to ensure that sources as well as base images are always fresh and in case of security updates always have the latest patches.

0 commit comments

Comments
 (0)