Skip to content

Commit ddd5ed9

Browse files
ci: Use the same Docker workflow for testing as publication (#812)
* 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
1 parent 26c8887 commit ddd5ed9

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,15 @@ jobs:
130130
runs-on: ubuntu-latest
131131

132132
steps:
133-
- uses: actions/checkout@v1.2.0
133+
- uses: actions/checkout@v2
134134
- name: Build Docker image
135-
run: |
136-
docker build . \
137-
--file docker/Dockerfile \
138-
--build-arg BASE_IMAGE=python:3.7-slim \
139-
--tag pyhf/pyhf:$GITHUB_SHA \
140-
--compress
141-
docker images
135+
if: "!(startsWith(github.ref, 'refs/tags/'))"
136+
uses: docker/build-push-action@v1
137+
with:
138+
repository: pyhf/pyhf
139+
dockerfile: docker/Dockerfile
140+
tag_with_sha: true
141+
tag_with_ref: true
142+
push: false
143+
- name: List built images
144+
run: docker images

.github/workflows/publish-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@master
1717
- name: Build and Publish to Registry
18-
if: "! ${{ startsWith(github.ref, 'refs/tags/') }}"
18+
if: "!(startsWith(github.ref, 'refs/tags/'))"
1919
uses: docker/build-push-action@v1
2020
with:
2121
username: ${{ secrets.DOCKER_USERNAME }}
@@ -24,7 +24,7 @@ jobs:
2424
dockerfile: docker/Dockerfile
2525
tags: latest
2626
- name: Build and Publish to Registry with Release Tag
27-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
27+
if: startsWith(github.ref, 'refs/tags/')
2828
uses: docker/build-push-action@v1
2929
with:
3030
username: ${{ secrets.DOCKER_USERNAME }}

0 commit comments

Comments
 (0)