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

Supprt tags in sub ref directory? #380

Closed
wxiaoguang opened this issue Nov 14, 2022 · 8 comments · Fixed by #382
Closed

Supprt tags in sub ref directory? #380

wxiaoguang opened this issue Nov 14, 2022 · 8 comments · Fixed by #382

Comments

@wxiaoguang
Copy link

The code says:

if ((process.env.GITHUB_REF || '').startsWith('refs/tags')) {
const tag = (process.env.GITHUB_REF || '').split('/').pop();
if (tag !== '' && tag !== undefined) {
return tag;
}
}

If GITHUB_REF=refs/tags/release/0.1.0, then the tag will be 0.1.0, but it should be release/0.1.0

Is the pop done by purpose? Could it support release/0.1.0 and use 0.1.0 as the version?

@caarlos0
Copy link
Member

this whole thing should probably be removed, probably, as goreleaser itself already handles it

#370

cc/ @crazy-max

@wxiaoguang
Copy link
Author

Thank you for your quick response.

IMO #370 is not enough. There is also a check like isTagDirty = git.isTagDirty(git.getTag())

const commit = await git.getShortCommit();
const tag = await git.getTag();
const isTagDirty = await git.isTagDirty(tag);

Then, release/0.1.0 will case error No tag found for commit aabbccdd. Snapshot forced and then the --snapshot will be applied (incorrectly).

if (isTagDirty) {
if (!inputs.args.includes('--snapshot') && !inputs.args.includes('--nightly')) {
core.info(`No tag found for commit ${commit}. Snapshot forced`);
snapshot = ' --snapshot';
}

@caarlos0
Copy link
Member

hmm, indeed... @crazy-max probably we should remove those and bump the action to v4...

@crazy-max
Copy link
Member

Hum I see yeah we might need a major bump.

@caarlos0
Copy link
Member

should be fixed in #370
will release soon

@wxiaoguang
Copy link
Author

wxiaoguang commented Dec 13, 2022

But the bug is in

if ((process.env.GITHUB_REF || '').startsWith('refs/tags')) {
const tag = (process.env.GITHUB_REF || '').split('/').pop();
if (tag !== '' && tag !== undefined) {
return tag;
}
}

?

It will return an incorrect tag to tag, then isTagDirty(tag) will trigger an error inside and return true, then in if (isTagDirty) block the --snapshot will be applied to the command argument?

@caarlos0 caarlos0 reopened this Dec 13, 2022
@caarlos0
Copy link
Member

ah sorry, the dirty thing is still there.

@caarlos0
Copy link
Member

#382 should fix it by removing it entirely.

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 a pull request may close this issue.

3 participants