Skip to content

Commit 2d5fde1

Browse files
committed
ci: run the release workflow when changes in PRs
This won't publish the image, but it will build as much of it as possible, and indicate if the release may fail.
1 parent 711466f commit 2d5fde1

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ on:
33
push: # publish to `main` tag on Docker Hub on merge to main: https://hub.docker.com/layers/cipherstash/proxy/main
44
branches:
55
- main
6+
pull_request: # run the release workflow when changes are made to it in PRs
7+
branches:
8+
- main
9+
paths:
10+
- '.github/workflows/release.yml'
611
release: # for cutting a numbered release (e.g. v2.1.9)
712
types: [published]
813
workflow_dispatch: # for running the workflow on an arbitrary branch or commit
@@ -107,6 +112,8 @@ jobs:
107112
timeout-minutes: 30
108113
needs:
109114
- build
115+
env:
116+
publish: ${{contains(fromJSON('["push", "release"]'), github.event_name)}}
110117
steps:
111118
- uses: actions/checkout@v4
112119

@@ -151,15 +158,19 @@ jobs:
151158
152159
- name: Create manifest list and push
153160
working-directory: ${{ runner.temp }}/digests
161+
env:
162+
DRY_RUN: ${{case(fromJSON(env.publish),' ','--dry-run')}} # run the `docker buildx` command with --dry-run if we're not publishing a release
154163
run: |
155-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
164+
docker buildx imagetools create ${{ env.DRY_RUN }} $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
156165
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
157166
158167
- name: Inspect image
168+
if: ${{ fromJSON(env.publish) }}
159169
run: |
160170
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
161171
162172
- name: Notify Multitudes
173+
if: ${{ fromJSON(env.publish) }}
163174
run: |
164175
curl --request POST \
165176
--fail-with-body \

0 commit comments

Comments
 (0)