mirror of
https://github.com/goreleaser/goreleaser-action.git
synced 2026-05-22 02:01:53 +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:
parent
81d25e3b66
commit
e198786300
8 changed files with 123 additions and 30 deletions
25
src/git.ts
Normal file
25
src/git.ts
Normal file
|
|
@ -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']);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue