Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to use .PreviousTag on templates #2683

Merged
merged 5 commits into from Nov 24, 2021
Merged

feat: allow to use .PreviousTag on templates #2683

merged 5 commits into from Nov 24, 2021

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Nov 22, 2021

Previous tag will be available as a template field. It will be empty if there are no previous tag (e.g. first ever release of a repo).

Changelog still works by using the first commit on those cases (as it already does today).

refs #2669

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 22, 2021
@caarlos0
Copy link
Member Author

one problem with this: on the first tag, this will actually be a commit... 🤔 which per-se is not that bad, its just that the name will not convey what it actually is at some point 🤔

@vercel vercel bot temporarily deployed to Preview November 24, 2021 01:31 Inactive
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 24, 2021 01:51 Inactive
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 24, 2021 02:01 Inactive
@caarlos0 caarlos0 marked this pull request as ready for review November 24, 2021 02:02
@caarlos0 caarlos0 changed the title feat: expose .PreviousTag feat: allow to use .PreviousTag on templates Nov 24, 2021
@caarlos0 caarlos0 requested a review from a team November 24, 2021 02:03
@caarlos0 caarlos0 self-assigned this Nov 24, 2021
@caarlos0 caarlos0 added the enhancement New feature or request label Nov 24, 2021
@caarlos0 caarlos0 added this to In progress in Board via automation Nov 24, 2021
@caarlos0 caarlos0 added this to the v1.1.0 milestone Nov 24, 2021
@caarlos0 caarlos0 enabled auto-merge (squash) November 24, 2021 02:04
@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #2683 (b06be12) into main (419b6fc) will increase coverage by 0.01%.
The diff coverage is 85.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2683      +/-   ##
==========================================
+ Coverage   84.76%   84.77%   +0.01%     
==========================================
  Files         103      103              
  Lines        7883     7890       +7     
==========================================
+ Hits         6682     6689       +7     
  Misses        985      985              
  Partials      216      216              
Impacted Files Coverage Δ
pkg/context/context.go 100.00% <ø> (ø)
internal/pipe/changelog/changelog.go 91.21% <62.50%> (-0.19%) ⬇️
internal/pipe/git/git.go 87.97% <100.00%> (+0.89%) ⬆️
internal/tmpl/tmpl.go 97.56% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 419b6fc...b06be12. Read the comment docs.

@@ -203,6 +211,14 @@ func getTag() (string, error) {
return tag, err
}

func getPreviousTag(current string) (string, error) {
if tag := os.Getenv("GORELEASER_PREVIOUS_TAG"); tag != "" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@blacktop
Copy link

one problem with this: on the first tag, this will actually be a commit... 🤔 which per-se is not that bad, its just that the name will not convey what it actually is at some point 🤔

Maybe a default v0.0.0 would make sense? I tried v0.0.0 and a commit hash in github's URL and both 404ed (I know that is not the only purpose of this feature, however. I kinda feel like a zero-ed out version would make more sense than a commit hash?

@blacktop
Copy link

I'm not intimately familiar with your code, but everything looked good to me. 👍

@caarlos0
Copy link
Member Author

Maybe a default v0.0.0 would make sense? I tried v0.0.0 and a commit hash in github's URL and both 404ed (I know that is not the only purpose of this feature, however. I kinda feel like a zero-ed out version would make more sense than a commit hash?

my comment was outdated, it will now be empty as stated in the docs... which makes sense, as if there is no previous tag, that's what I would expect...

Copy link
Contributor

@dirien dirien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

Board automation moved this from In progress to Reviewer approved Nov 24, 2021
@caarlos0 caarlos0 merged commit cd261a5 into main Nov 24, 2021
Board automation moved this from Reviewer approved to Done Nov 24, 2021
@caarlos0 caarlos0 deleted the previous-tag branch November 24, 2021 12:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
Board
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants