pantheon-systems / autotag

Git repository version tagging tool
http://godoc.org/github.com/pantheon-systems/autotag
Apache License 2.0
192 stars 43 forks source link

Migrate to GitHub Actions #54

Closed vtopc closed 3 years ago

vtopc commented 3 years ago

This PR closes #39 and based on #46 since it was abandoned. Also, I have added few improvements here:


Prerequirements

GHA workflows structure

Because GHA doesn't have an equivalent of the CircleCI workflows config, two workflow configs are added for GHA:

CI.yml

image Contains few jobs:

Made separate test, lint, goreleaser-check jobs just for single responsibility principle and speed as they run in parallel(otherwise they will run for around 1 minute).

release.yml

Has one job, which is triggered only by a new v* tag(created by CI / tag). Used https://github.com/goreleaser/goreleaser-action#run-on-new-tag as an example. As benefits:

  1. It will allow us to do some kind of reverts - creating a new tag for previous commits will trigger this flow.
  2. Contributors will trigger only CI workflow.

Notes

Test plan

CI workflow

after merging:

joemiller commented 3 years ago

I'd like to keep support for [skip ci] / [ci skip] commits like other CI providers support. Last I looked GHA didn't directly support this but could be replicated via something like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L11 can we add support for this here? (or maybe GHA supports this natively by now? I don't know)

joemiller commented 3 years ago

RE: not caching, that makes sense to me due to the time, but we probably should consider doing it to be good citizens and reduce bandwidth usage for others. It's not hard to do with the GHA like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L17-L22

Would you mind trying it and if it's a quick drop-in we can keep it, but if there are some complications we can skip?

vtopc commented 3 years ago

I'd like to keep support for [skip ci] / [ci skip] commits like other CI providers support. Last I looked GHA didn't directly support this but could be replicated via something like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L11 can we add support for this here? (or maybe GHA supports this natively by now? I don't know)

Sure.

vtopc commented 3 years ago

RE: not caching, that makes sense to me due to the time, but we probably should consider doing it to be good citizens and reduce bandwidth usage for others. It's not hard to do with the GHA like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L17-L22

Would you mind trying it and if it's a quick drop-in we can keep it, but if there are some complications we can skip?

OK, will try.

vtopc commented 3 years ago

RE: not caching, that makes sense to me due to the time, but we probably should consider doing it to be good citizens and reduce bandwidth usage for others. It's not hard to do with the GHA like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L17-L22

Would you mind trying it and if it's a quick drop-in we can keep it, but if there are some complications we can skip?

Done.

vtopc commented 3 years ago

I'd like to keep support for [skip ci] / [ci skip] commits like other CI providers support. Last I looked GHA didn't directly support this but could be replicated via something like: https://github.com/joemiller/certin/blob/master/.github/workflows/main.yaml#L11 can we add support for this here? (or maybe GHA supports this natively by now? I don't know)

I couldn't do that, it's just skipping any commit.