Build Docker image and push to GHCR#230
Conversation
|
This looks.. intriguing! I don't remember if I ever considered combining composite+docker actions (I did play with having two composites in the same repo in the past, though). I'll need to take some time to think about it and look through the patch more closely. Please, don't expect an immediate review, however it does look very promising at glance! Originally I thought that I'd have a workflow where I trigger a release, that release adds a commit that hardcodes an update to This looks like a better idea so far. Thanks again! |
|
That sounds great. Take your time. Thanks for your consideration. If you do decide to accept this change, I'm happy to help maintain the workflows in the future. Feel free to mention me @br3ndonland and I will help address any issues that come up. |
|
Thanks! I've hit "rebase" on the UI to get this on top of the recent changes/linting/lockfile bumps but haven't yet looked into it deeper. |
|
I'm done with the initial review. More is needed, but I'd rather accept what I can through separate PRs to make this one smaller. And the suggested refactoring could be done in parallel. I think that generating the file is a good idea. It should be possible to write the file without bringing in the PyYAML dependency. But it's not that easy for reading it. Can we make use of |
|
@webknjaz thank you for your detailed review. I've addressed most of your comments so far. |
|
Commits like 213c885ac41d769527ac150e2e633bb1ccd886d4 aren't really necessary since Git would automatically absorb changes applied separately. FYI. In fact, this one may have a harmful effect — when the label change is merged into the default branch, and this one rebased on top, Git will keep the removal commit and attempt deleting the label 🤷♂️ Anyway, we'll address this later on. |
|
@br3ndonland I'm sure my review is incomplete, but hopefully it gives you enough ideas to try out until the next time. I think it'd be nice to get this in before #236 if at all possible. |
|
@br3ndonland could you also rebase this branch locally? The GH button doesn't work, meaning there's going to be some conflicts to resolve. |
No problem. I'm not sure what "the GH button" is (some GitHub Mobile thing?) but I've rebased the branch. I will address the other comments soon. Looks like there's a small |
#230 (comment) Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
for more information, see https://pre-commit.ci
At your request (#230 (comment)), the
After navigating to the action, there will be a "Run workflow" button. To publish an image for a specific release, v1.13.0 for example:
Currently the workflow will automatically build and push Docker images whenever new commits are pushed to
Why wouldn't you want to push a Docker image for
The case of
Your repo does not have any branches or tags named If you're publishing a Docker image for a specific release, enter the name of the tag as I said above.
|
Are you sure you're looking at the latest PR diff? Right now, when I look at https://github.com/pypa/gh-action-pypi-publish/pull/230/files#diff-63d86cca28be8586869affd2baf5d48489229f5d9b4684c11beb787eee6f614cR9-R14, I see a single input — Though, reading through the workflow, the docker image tag is computed from the tag input, which makes sense to me.
Oh… That's the bit I've been overlooking.
Oh, I was just writing down my confusion. I didn't look into the PR in a while, so I didn't remember all the context and got lost. It makes sense now.
This was very helpful to refresh my understanding of the bits and pieces of the updates in the PR. Thank you! I think I'm ready to merge it finally. I'll then try it out and let you know if something is still uncertain. |
|
I just pushed |
This is a follow-up for #230, which renamed the workflow filename.
|
@br3ndonland here are some regressions reported:
Could you help me figure them out? |
|
v1.12.1 addresses immediate problems from the list above. Long-term, the release process will need to be improved and made more cohesive. |
@webknjaz thanks for handling the user feedback so far. Here are some updates to the list you provided.
|
Description
Closes #58
Up to this point, the project has been set up as a Docker action referencing the Dockerfile.
gh-action-pypi-publish/action.yml
Lines 86 to 88 in 3fbcf7c
The downside to using the Dockerfile for the action is that the Docker image must be built every time the action is used (#58).
This PR will set up the project to build the Docker image and push it to GitHub Container Registry (GHCR). This change will speed up user workflows every time the action is used because the workflows will simply pull the Docker image from GHCR instead of building again.
Changes
Build container image with GitHub Actions
This PR will build Docker images with the Docker CLI (
docker build). Builds will include inline cache metadata so layers can be reused by future builds.This PR only proposes to build container images for
x86_64(linux/amd64) because GitHub Actions Linux runners currently only supportx86_64CPU architectures (actions/runner-images#5631), and this project only supports GitHub Actions Linux runners. The README explains:Push container image to GHCR
The workflow will log in to GHCR using the built-in GitHub token and push the Docker image. Workflow runs triggered by pull requests will build the Docker image and run the smoke tests but will not push the Docker image.
Update action to pull container image from GHCR
Docker actions support pulling in pre-built Docker images by supplying a registry address to the
image:key. The downside to this syntax is that there's no way to specify the correct Docker tag because the GitHub Actionsimage:anduses:keys don't accept any context. For example, if a user's workflow hasuses: pypa/gh-action-pypi-publish@release/v1.8, then the action should pull in a Docker image built from therelease/v1.8ref, something likeghcr.io/pypa/gh-action-pypi-publish:release-v1.8(Docker tags can't have/).The workaround is to switch the top-level
action.ymlto a composite action that then calls the Docker action, substituting the correct image name and tag.Related
github.action_repositoryandgithub.action_refare empty inrunfor composite actions actions/runner#2473