Skip to content

Commit c0d4b9c

Browse files
authored
Merge pull request #50 from twinh/patch-1
Push git tag to docker hub
2 parents 3de5c19 + cb7c103 commit c0d4b9c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/dockerimage.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ name: Docker Image CI
33
on:
44
push:
55
branches: master
6+
tags: '**'
67
schedule:
78
- cron: 0 0 * * 6
89

10+
env:
11+
TAG_PREFIX: $([ ${GITHUB_REF#refs/*/} == "master" ] && echo "latest" || echo ${GITHUB_REF#refs/*/})
12+
913
jobs:
1014
build:
1115
runs-on: ubuntu-latest
@@ -19,7 +23,7 @@ jobs:
1923
PHP_VERSION: ${{ matrix.php_version }}
2024
run: |
2125
export TAG_VERSION=${PHP_VERSION:0:1}.${PHP_VERSION:1:1}
22-
docker build . --file Dockerfile-${{ matrix.php_version }} --tag laradock/php-fpm:latest-${TAG_VERSION}
26+
docker build . --file Dockerfile-${{ matrix.php_version }} --tag laradock/php-fpm:${{ env.TAG_PREFIX }}-${TAG_VERSION}
2327
docker image ls
2428
2529
- name: Push image to Docker hub
@@ -29,5 +33,5 @@ jobs:
2933
run: |
3034
export TAG_VERSION=${PHP_VERSION:0:1}.${PHP_VERSION:1:1}
3135
echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
32-
docker push laradock/php-fpm:latest-${TAG_VERSION}
36+
docker push laradock/php-fpm:${{ env.TAG_PREFIX }}-${TAG_VERSION}
3337
docker logout

0 commit comments

Comments
 (0)