-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Docker pushes on release branches #1568
Allow Docker pushes on release branches #1568
Conversation
@mre Could you review? Do you know if this will work as I've updated it here? Otherwise, it might be possible in a separate step to include the new logic, and set an environment variable to WDYT? |
.github/workflows/docker.yml
Outdated
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }} | ||
push: ${{ (github.event_name != 'pull_request' && | ||
github.actor != 'dependabot[bot]') || | ||
startsWith(github.ref_name, 'release-plz') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but is the ref_name
for release-plz
documented somewhere? I was wondering if we should check for a tag name instead. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mre It's documented here: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context, but taking a closer look, it might not work for a pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mre I've refactored this pull request. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mre Did you want me to ask another maintainer to review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry for dropping the ball on this. 😅
697800c
to
f2ae4a7
Compare
Thanks for your contribution (and your patience), @eread. 🥳 |
@mre @thomas-zahner We got a run of the new logic: https://github.com/lycheeverse/lychee/actions/runs/12389086296/job/34581417146 It looks like Also, the Docker command was run with |
@trask I don't suppose you know how to resolve this? |
The tags are because the pipeline didn't run on a release. The version tag is missing. So either we're not listening to the right event or the logs belong to a different pipeline run. |
Yeah, so we don't trigger a pull request on releases. Typically this is done with on:
release:
types: [published] However, in our case we have a wait until the release binaries are created; otherwise the build would fail. I don't know if there's a way to say that the workflow depends on another one. Alternatively, we could just have a "wait" step in the pipeline, which tries to curl the binary every 30 seconds or so until it succeeds. |
We could trigger on release as shown above and use an action like https://github.com/marketplace/actions/wait-on to wait until the binaries were created. |
@mre I must've misunderstood how these work: #1598. I guess the release is created when this is merged, and so the release isn't in the context of the pull request anymore. |
@mre It looks like you can make jobs depend on each other with |
@mre What about running when a tag is pushed: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore? |
@mre Or maybe we should remove this "escape early" configuration: lychee/.github/workflows/docker.yml Line 31 in fc006bd
|
Hum, I'm not sure why that was there. I removed it.. Thanks for the idea. We can give it another try on the next release. |
|
As outlined in #1432 (comment), the current workflow won't push to the Docker registry when a release is cut because releases now include a pull request.
This pull request increases the number of conditions under which a Docker image can be pushed.
Closes #1432.