Skip to content

Commit 0a09c73

Browse files
committed
ci: build docker image on pull request without pushing
1 parent 9fc4603 commit 0a09c73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/workflows/publish-docker-image.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
tags:
1212
- v*
1313

14+
# Run tests for any PRs.
15+
pull_request:
16+
1417
env:
1518
IMAGE_NAME: cspec-alpine
1619

@@ -33,10 +36,12 @@ jobs:
3336
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
3437

3538
- name: Log in to registry
39+
if: github.event_name == 'push'
3640
# This is where you will update the PAT to GITHUB_TOKEN
3741
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
3842

3943
- name: Push image
44+
if: github.event_name == 'push'
4045
run: |
4146
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
4247

0 commit comments

Comments
 (0)