Skip to content

Add support for multiple semver tags#10

Closed
fastlorenzo wants to merge 9 commits intodocker:masterfrom
fastlorenzo:master
Closed

Add support for multiple semver tags#10
fastlorenzo wants to merge 9 commits intodocker:masterfrom
fastlorenzo:master

Conversation

@fastlorenzo
Copy link
Copy Markdown

This PR relates to issue #6

If full-semver input is set to true, the action will try to parse the version tag (using semver package) and extract the major, minor, patch and prerelease components.

Example for input tag v1.2.3-beta.4, the following tags will be added:

  • v1
  • v1.2
  • v1.2.3

Note that to add the prefix (v in this case), the following input option has been added as well: semver-prefix (in this case, it is equal to v)

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 4, 2020

Codecov Report

Merging #10 into master will increase coverage by 1.15%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   71.21%   72.36%   +1.15%     
==========================================
  Files           3        3              
  Lines          66       76      +10     
  Branches       14       16       +2     
==========================================
+ Hits           47       55       +8     
  Misses          6        6              
- Partials       13       15       +2     
Impacted Files Coverage Δ
src/context.ts 92.30% <ø> (ø)
src/meta.ts 74.07% <80.00%> (+1.34%) ⬆️

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 dd2e615...c527b1b. Read the comment docs.

Comment on lines +577 to +579
'ghcr.io/user/app:v2',
'ghcr.io/user/app:v2.0',
'ghcr.io/user/app:v2.0.8',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

v2, v2.0 and v2.0.8 tags should not be generated for pre-release. As explained in semver specification prerelease versions are updated frequently, and contain many breaking changes that are (by the author's design) not yet fit for public consumption.

sepLabels: core.getInput('sep-labels') || `\n`,
githubToken: core.getInput('github-token')
githubToken: core.getInput('github-token'),
fullSemver: /true/i.test(core.getInput('full-semver') || 'false'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fullSemver: /true/i.test(core.getInput('full-semver') || 'false'),
fullSemver: /true/i.test(core.getInput('full-semver')),

@crazy-max
Copy link
Copy Markdown
Member

And also update the relevant documentation.

@crazy-max
Copy link
Copy Markdown
Member

crazy-max commented Nov 13, 2020

@fastlorenzo I thought a little bit more about the implementation and I think we should go through templating instead. I had been working on this via #3 and I think I'll put it back for your use case. The idea will be to improve this feature by using a list of versions that you want to assign as tags:

-  
  name: Docker meta
  uses: crazy-max/ghaction-docker-meta@v1
  with:
    images: name/app
    tag-semver: |
      v{{major}}
      v{{major}}.{{minor}}
      v{{major}}.{{minor}}.{{patch}}

@fastlorenzo
Copy link
Copy Markdown
Author

Looks good to me as well, but what does it do when ref is not a valid semver (for example, using the same action to build container for a tag or for a push in a branch)?

@crazy-max
Copy link
Copy Markdown
Member

@fastlorenzo Will do nothing if it's not a valid semver.

@fastlorenzo
Copy link
Copy Markdown
Author

@fastlorenzo Will do nothing if it's not a valid semver.

ok then I guess we can close this PR and go with your solution using tag-semver 😄

@crazy-max crazy-max mentioned this pull request Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants