Skip to content

Commit

Permalink
ci: Use the same Docker workflow for testing as publication (#812)
Browse files Browse the repository at this point in the history
* Use the same Docker build workflow in testing as is used in publication to Docker Hub
   - Amends PR #808
* Use suggested () syntax as ${{ }} is ignored in 'if' statements
   - https://twitter.com/joshmgross/status/1241088248572776451
  • Loading branch information
matthewfeickert authored Mar 20, 2020
1 parent 26c8887 commit ddd5ed9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1.2.0
- uses: actions/checkout@v2
- name: Build Docker image
run: |
docker build . \
--file docker/Dockerfile \
--build-arg BASE_IMAGE=python:3.7-slim \
--tag pyhf/pyhf:$GITHUB_SHA \
--compress
docker images
if: "!(startsWith(github.ref, 'refs/tags/'))"
uses: docker/build-push-action@v1
with:
repository: pyhf/pyhf
dockerfile: docker/Dockerfile
tag_with_sha: true
tag_with_ref: true
push: false
- name: List built images
run: docker images
4 changes: 2 additions & 2 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Build and Publish to Registry
if: "! ${{ startsWith(github.ref, 'refs/tags/') }}"
if: "!(startsWith(github.ref, 'refs/tags/'))"
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -24,7 +24,7 @@ jobs:
dockerfile: docker/Dockerfile
tags: latest
- name: Build and Publish to Registry with Release Tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
Expand Down

0 comments on commit ddd5ed9

Please sign in to comment.