jenkins-infra / jenkins-maven-cd-action

1 stars 7 forks source link

feat: create an annotated tag instead of a ligthweight tag to ensure the correct timestamp #26

Closed dduportal closed 2 years ago

dduportal commented 2 years ago

This PR fixes https://github.com/jenkins-infra/jenkins-maven-cd-action/issues/25.

It ensures that an annotated tag is created before publishing the release.

It follows the official Git API documentation about creating tags in https://docs.github.com/en/rest/git/tags#create-a-tag-object:

Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary.

Note: I have no idea how to properly test this in "real life" scenario. I tried in https://github.com/jenkinsci/jenkins-infra-test-plugin/pull/45 but it seems that we use 2 levels of actions and there are "local" actions (e.g. restricted to the organization).

I'll try to publish my modified action to gh action and work with it but it's not really easy: any tip is welcome

timja commented 2 years ago

Note: I have no idea how to properly test this in "real life" scenario. I tried in https://github.com/jenkinsci/jenkins-infra-test-plugin/pull/45 but it seems that we use 2 levels of actions and there are "local" actions (e.g. restricted to the organization).

your repo: https://github.com/dduportal/github-reusable-workflow

doesn't exist.

you need to fork that and point it to your other repo / branch.

or just push an origin branch

dduportal commented 2 years ago

I went for https://github.com/jenkinsci/jenkins-infra-test-plugin/pull/47 for testing. It's hackish but it should do.

@timja https://github.com/dduportal/github-reusable-workflows exists (plural form as per https://github.com/jenkinsci/jenkins-infra-test-plugin/pull/45/files#diff-ea3ea8c9932adc7ba8161ceda844fedd43b006848ef1140c050cbd7ea0788a18R14)

dduportal commented 2 years ago

Current testing says: + gh api -F tag=98.vb_b_93ee907771 -F message=98.vb_b_93ee907771 -F object=bb93ee907771855f57c71f61eabfece9e2c57594 -F type=commit /repos/jenkinsci/jenkins-infra-test-plugin/git/tag

I guess I have to rework it a bit :)

dduportal commented 2 years ago

Result: https://github.com/jenkinsci/jenkins-infra-test-plugin/releases/tag/103.v27fc0f21e2e1