mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-07-08 22:07:31 +00:00
improvement: Review snapshot behavior (#95)
* Improve git tag detection (#77) * Only handle snapshot flag for release cmd (#94) * Use core.info instead of console.log * Update gitattributes
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
import * as child_process from 'child_process';
|
||||
|
||||
const git = async (args: string[] = []) => {
|
||||
const stdout = child_process.execSync(`git ${args.join(' ')}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
return stdout.trim();
|
||||
};
|
||||
|
||||
export async function isTagDirty(currentTag: string): Promise<boolean> {
|
||||
try {
|
||||
await git(['describe', '--exact-match', '--tags', '--match', currentTag]);
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function getTag(): Promise<string> {
|
||||
return await git(['describe', '--tags', '--abbrev=0']);
|
||||
}
|
||||
|
||||
export async function getShortCommit(): Promise<string> {
|
||||
return await git(['show', "--format='%h'", 'HEAD', '--quiet']);
|
||||
}
|
||||
Reference in New Issue
Block a user