Skip to content

Commit b1fb13b

Browse files
author
Julien Neuhart
committed
Add GitHub actions to replace Travis
1 parent 24381e5 commit b1fb13b

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/workflow.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docker PHP Images GitHub workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'v3'
7+
push:
8+
branches:
9+
- 'v3'
10+
schedule:
11+
- cron: '0 0 * * 0'
12+
13+
14+
jobs:
15+
build_test_maybe_release:
16+
strategy:
17+
matrix:
18+
include:
19+
- variant: 'cli'
20+
php_version: '7.4'
21+
- variant: 'apache'
22+
php_version: '7.4'
23+
- variant: 'fpm'
24+
php_version: '7.4'
25+
- variant: 'cli'
26+
php_version: '7.3'
27+
- variant: 'apache'
28+
php_version: '7.3'
29+
- variant: 'fpm'
30+
php_version: '7.3'
31+
- variant: 'cli'
32+
php_version: '7.2'
33+
- variant: 'apache'
34+
php_version: '7.2'
35+
- variant: 'fpm'
36+
php_version: '7.2'
37+
- variant: 'cli'
38+
php_version: '7.1'
39+
- variant: 'apache'
40+
php_version: '7.1'
41+
- variant: 'fpm'
42+
php_version: '7.1'
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v1
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v1
49+
- uses: actions/checkout@v1
50+
- name: Build and test
51+
uses: docker/build-push-action@v2
52+
run: |
53+
PHP_VERSION="${{ matrix.php_version }}" BRANCH="$GITHUB_REF_NAME_SLUG" VARIANT="${{ matrix.variant }}" ./build-and-test.sh
54+
docker images | grep thecodingmachine/php
55+
- name: Login to DockerHub
56+
# Merge ~ push.
57+
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
58+
uses: docker/login-action@v1
59+
with:
60+
username: ${{ secrets.DOCKERHUB_USERNAME }}
61+
password: ${{ secrets.DOCKERHUB_TOKEN }
62+
- name: Release
63+
uses: docker/build-push-action@v2
64+
# Merge ~ push.
65+
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
66+
run: |
67+
BRANCH_VARIANT=`echo "${{ matrix.variant }}" | sed 's/\./-/g'`
68+
docker push thecodingmachine/php:${{ matrix.php_version }}-${GITHUB_REF_NAME_SLUG}-slim-${BRANCH_VARIANT}
69+
docker push thecodingmachine/php:${{ matrix.php_version }}-${GITHUB_REF_NAME_SLUG}-${BRANCH_VARIANT}
70+
docker push thecodingmachine/php:${{ matrix.php_version }}-${GITHUB_REF_NAME_SLUG}-${BRANCH_VARIANT}-node8
71+
docker push thecodingmachine/php:${{ matrix.php_version }}-${GITHUB_REF_NAME_SLUG}-${BRANCH_VARIANT}-node10
72+
docker push thecodingmachine/php:${{ matrix.php_version }}-${GITHUB_REF_NAME_SLUG}-${BRANCH_VARIANT}-node12

0 commit comments

Comments
 (0)