glanceapp / glance

A self-hosted dashboard that puts all your feeds in one place
GNU Affero General Public License v3.0
7.49k stars 260 forks source link

Create release workflow #108

Closed wfg closed 1 month ago

wfg commented 4 months ago

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:

  1. .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).
  2. .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:

  1. 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.
  2. 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.

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.

svilenmarkov commented 4 months ago

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!

wfg commented 4 months ago

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.

svilenmarkov commented 1 month ago

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!