Skip to content

Commit

Permalink
Merge pull request #1845 from locustio/fix-docker-builds
Browse files Browse the repository at this point in the history
Fix docker builds
  • Loading branch information
cyberw authored Aug 8, 2021
2 parents 611025f + 8066f28 commit 0c67277
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,45 @@ jobs:
- run: tox -e ${{ matrix.tox }}

verify_docker_build:
name: Verify Docker image build
name: Verify docker, push if on master
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: locustbuild
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: false
tags: locustio/locust:latest

push: ${{ github.ref == 'refs/heads/master' }}
tags: locustio/locust:master

docker_tagged:
name: Push to version-specific tag, also push latest if on master
needs: tests
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Get git tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: locustbuild
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: locustio/locust:${{ steps.tag.outputs.tag }}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }}

release:
name: Release to PyPI
needs: verify_docker_build
Expand All @@ -80,3 +107,10 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Push to docker
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: locustio/locust:${{ github.event.release.tag_name }} # tags the image based on git tag name instead of package version, but that should be good enough.

0 comments on commit 0c67277

Please sign in to comment.