Repository navigation
ci: deploy branches only when their PR has the preview label - #258
Merged
Merged
Conversation
Lint and tests still run on every push. The image build and the <ref>_deploy tag now only happen for main, tags (releases), branches whose open PR carries the `preview` label, and manual runs (workflow_dispatch). preview.yml runs ci.yml on the branch when the label is added, so the branch head is built rather than the PR merge commit, and deletes the deploy tag when the label is removed or the PR is closed.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Lint and tests still run on every push. The image build and the
<ref>_deploytag now only happen for:mainand tags (releases), as before;previewlabel;workflow_dispatch) on any branch.ci.ymldeploy-targetjob decides whether to deploy. It runs alongsidelint-and-test. On a branch other than main, it deploys only if the branch has an open PR labelledpreview.build-dockerruns only whendeploy-targetsays yes, andtag-deploywaits for it.preview.yml(new)ci.ymlon the branch throughworkflow_dispatch. That run builds the branch's last commit and tags<branch>_deploy. Apull_requestrun can't do this, becauseref_namewould beN/mergeand it would check out the merge commit. Later pushes redeploy through the normal push run.<branch>_deployif it exists.delete-ref.ymlstill deletes it when the branch is deleted.Why?
Every push to every branch built an image and moved a deploy tag. WIP pushes cost runner time, registry space and an environment. Now previews are opt-in.
How?
lint-and-testand skipsbuild-docker/tag-deploy;previewto this PR starts a manual run that deploysci/preview-label-deploys_deploy;Before merging
previewlabel. It doesn't exist in the repo yet._deploytag removes the environment, and that nothing expects a deploy tag for every branch.Types of changes
Checklist: