Skip to content

Commit 0d6b8da

Browse files
committed
Build the Docker image on pushes, tags, and pull requests
Previously, we'd only build the Docker image on pushes and PRs to main. In particular, that excluded tags (even on main). With this patch, build the Docker image all the time, but only push it to ghcr.io when we tag, which is consistent with how we upload to PyPI.
1 parent 435a87e commit 0d6b8da

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

.github/workflows/build-docker.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Build Docker image
22

33
on:
4-
push:
5-
branches: ['main']
6-
pull_request:
7-
branches: ['main']
4+
- push
5+
- pull_request
86

97
permissions:
108
contents: read
@@ -32,6 +30,6 @@ jobs:
3230
id: push
3331
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
3432
with:
35-
push: ${{ github.event_name == 'push' }}
33+
push: ${{ startsWith(github.ref, 'refs/tags/') }} # only push to ghcr.io on tags
3634
tags: ghcr.io/${{github.repository}}:latest
3735
context: . # use the current directory as context, as checked out by actions/checkout -- needed for setuptools_scm

0 commit comments

Comments
 (0)