ci: run as much of release workflow as possible in PRs#360
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables testing of the release workflow in pull requests by adding a pull_request trigger that activates when changes are made to the workflow file itself. It introduces conditional logic to run the workflow in "dry-run" mode for PRs, preventing the final multi-platform image manifest from being published to Docker Hub while still exercising most of the workflow steps.
Changes:
- Added
pull_requesttrigger for changes to the release workflow file - Added conditional
DRY_RUNenvironment variable to skip publishing the manifest in PR mode - Added conditional execution for image inspection and Multitudes notification steps to only run on actual releases
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Create manifest list and push | ||
| working-directory: ${{ runner.temp }}/digests | ||
| env: | ||
| DRY_RUN: ${{ case(contains(fromJSON('["push", "release"]'), github.event_name),"", "--dry-run") }} # run the `docker buildx` command with --dry-run if we're not publishing a release |
There was a problem hiding this comment.
The function name case is not valid in GitHub Actions expressions. The correct function name is if. This line should use the ternary-like syntax: if(condition, value_if_true, value_if_false).
The expression should be:
${{ if(contains(fromJSON('["push", "release"]'), github.event_name), '', '--dry-run') }}
Without this fix, the workflow will fail when it tries to evaluate this expression.
| DRY_RUN: ${{ case(contains(fromJSON('["push", "release"]'), github.event_name),"", "--dry-run") }} # run the `docker buildx` command with --dry-run if we're not publishing a release | |
| DRY_RUN: ${{ if(contains(fromJSON('["push", "release"]'), github.event_name), '', '--dry-run') }} # run the `docker buildx` command with --dry-run if we're not publishing a release |
There was a problem hiding this comment.
Because it's faster
This won't publish the image, but it will build as much of it as possible, and indicate if the release may fail.
2e8496d to
2d5fde1
Compare
Currently we don't automatically test changes to the
releaseworkflow in PRs. This means we have to contort our PRs to test changes (by committing new triggers, then rewriting commit history to edit them out), or trigger several releases to test changes to thereleaseworkflow (essentially testing in prod).This PR runs as much of the
releaseworkflow as possible in PRs, without publishing the final image to Docker Hub.It also:
cargo-binstallto one that builds (1.17.4currently erroring at compilation time)Acknowledgment
By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.