gojuno / minimock

Powerful mock generation tool for Go programming language
MIT License
632 stars 38 forks source link

Release minimock by CI #81

Closed suzuki-shunsuke closed 9 months ago

suzuki-shunsuke commented 9 months ago

Now prebuilt binaries are released by executing GoReleaser on the maintainer's lap top.

https://github.com/gojuno/minimock/issues/79#issuecomment-1876228941

I think it's great if we can release minimock by CI such as GitHub Actions. We can automate the release process. When we face issues about releases, we can look into them if the release is executed on CI. On the other hand, if the release is run on maintainers' lap top, other than maintainers can't contribute to issues.

If the proposal is acceptable, I'm interested in working on this.

hexdigest commented 9 months ago

This is a good idea, I'd like to continue using goreleaser and it seems that there's a goreleaser GH action for that. The only thing I don't really understand is who and how will assign a version number to the release. Currently I just tag latest commit and run make release but in case of GH action we probably need an input to tag latest commit prior to goreleaser release execution. Alternatively we can have two inputs:

  1. commit hash
  2. version tag to assign

Maybe there are other options.

suzuki-shunsuke commented 9 months ago

How about triggering workflows by pushing GitHub tags?

e.g. https://github.com/aquaproj/aqua/blob/00115fe2d11fd2c87d8aecac132b4f1c486e4188/.github/workflows/release.yaml#L3-L5

on:
  push:
    tags: [v*]

Then we can create a release using the pushed tag.

hexdigest commented 9 months ago

Well the main question for me is who should be able to push tags/release new versions.

suzuki-shunsuke commented 9 months ago

Users who have the write permission in this repository can push tags. We can restrict users by checking github.actor in GitHub Actions workflows. And we can also restrict users to only users with admin or maintain permissions in the repository by tag protection rules.

https://docs.github.com/en/enterprise-server@3.8/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules

When you add a tag protection rule, all tags that match the pattern provided will be protected. Only users with admin or maintain permissions in the repository will be able to create protected tags, and only users with admin permissions in the repository will be able to delete protected tags.

suzuki-shunsuke commented 9 months ago