glance
                                
                                 glance copied to clipboard
                                
                                    glance copied to clipboard
                            
                            
                            
                        Create release workflow
This PR contains everything needed to replace the current build script. It uses GoReleaser to build the Go binary and package it in both archives and Docker multi-arch images.
Assuming this is all new to the reader, there are two new pieces:
- .goreleaser.yaml: This configures goreleaser to mimic the functionality of the existing build script (and extend it to push the Docker image to the GitHub Packages registry for the repository).
- .github/workflows/releaser.yaml: This defines the workflow ("pipeline") that runs goreleaser.
I won't go line-by-line in each file, but there are a couple things to call out:
- This workflow only runs when a tag that starts with "v" (e.g. "v1.2.3") is pushed. If you want to run it at other times as well (e.g. every push/PR/etc), that can be configured.
- If you want to push to Docker Hub, you should generate an access token to authenticate.
You can see an example of everything this provides in my fork.
- workflow output: https://github.com/wfg/glance/actions/runs/9230206041/job/25397943810
- resulting release: https://github.com/wfg/glance/releases/tag/v0.1.0
- resulting container image: https://github.com/wfg/glance/pkgs/container/glance
To produce this example, I only created an empty commit with git commit -m "Produce example" --allow-empty and tagged it with git tag v0.1.0. Once that was pushed, all of the above happened automatically.
I am considering this a draft until reviewed by @svilenmarkov. If and when they approve the idea, I will uncomment the Docker Hub portion of .goreleaser.yaml and update the project_name variable.
Hey, that's pretty cool, thank you so much!
You were right about it not being that complicated but there are some parts that are a little alien to me and I'd like to make sure I'm comfortable with them before merging. I'll have a play with it and maybe leave some further comments. This will definitely save me a good amount of time though, thank you again!
Happy to help! It was an interesting exercise.
This was the first time I used the goreleaser Docker image build functionality, and I agree, it is a bit unintuitive at first. I did try to organize the sections "chronologically" to help with that (build -> archiving -> image building -> image bundling).
If I can help clear anything up, please let me know.
Finally got to playing with this and after a bunch of fighting with goreleaser I think I got to a state I'm happy with. The only thing I couldn't get working was having just the final multi arch docker image to get pushed rather than it plus all the individual platforms but It's not the end of the world. Thanks again for doing this!