Skip to content

Commit

Permalink
Use github action to deploy docker (#2)
Browse files Browse the repository at this point in the history
* Use github actions

* minor

* monr

* typo

* Better support for tags

* Release ready

* Filter tags better

* revert
  • Loading branch information
Nyholm authored Jan 11, 2020
1 parent 8e3ed2e commit 41a860c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Docker images

on:
push:
tags:
- '*' # On all tags

jobs:
publish:
name: Building images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Build images
run: |
echo $GITHUB_REF
cd runtime
make docker-images
- name: Publish
env:
DOCKER_USERNAME: ${{ secrets.dockerUsername }}
DOCKER_PASSWORD: ${{ secrets.dockerPassword }}
DOCKER_TAG: ${{ steps.get_version.outputs.VERSION }}
run: |
echo $GITHUB_REF
echo $DOCKER_TAG
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
make publish-docker-images
17 changes: 0 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
php: 7.2
before_script: composer update --prefer-lowest --prefer-stable -n
script: vendor/bin/phpunit --testsuite small
env:
DEPLOY_JOB: true

# - name: 'Runtime tests'
# php: 7.3
Expand All @@ -52,18 +50,3 @@ jobs:
php: 7.3
before_script: composer install -n
script: vendor/bin/phpstan analyse

before_deploy:
- cd runtime
- DOCKER_BUILD_FLAGS="--quiet" travis_wait 90 make docker-images
- cd ..

deploy:
provider: script
script: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && DOCKER_BUILD_FLAGS="--quiet" make docker-images
skip_cleanup: true
on:
repo: brefphp/bref
tags: true
all_branches: true
condition: $DEPLOY_JOB = true
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
runtimes:
cd runtime && make publish

docker-images:
publish-docker-images:
ifndef DOCKER_TAG
$(error DOCKER_TAG is not set)
endif

cd runtime && make docker-images
for image in \
"bref/php-72" "bref/php-72-fpm" "bref/php-72-fpm-dev" \
Expand All @@ -15,7 +19,7 @@ docker-images:
"bref/build-php-74" \
"bref/fpm-dev-gateway"; \
do \
docker tag $$image:latest $$image:${TRAVIS_TAG} ; \
docker tag $$image:latest $$image:${DOCKER_TAG} ; \
docker push $$image ; \
done

Expand Down

0 comments on commit 41a860c

Please sign in to comment.