diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a43a3b8a0d..18532d3c70 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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.