mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-06-30 20:17:32 +00:00
6c7b10c265
* Use native GitHub Action tools to download assets and use GitHub API * Fix unexpected output when tag not found * Use GitHub Action exec * Add screenshot Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
32 lines
780 B
TypeScript
32 lines
780 B
TypeScript
import * as exec from './exec';
|
|
|
|
const git = async (args: string[] = []): Promise<string> => {
|
|
return await exec.exec(`git`, args, true).then(res => {
|
|
if (res.stderr != '' && !res.success) {
|
|
throw new Error(res.stderr);
|
|
}
|
|
return res.stdout.trim();
|
|
});
|
|
};
|
|
|
|
export async function getTag(): Promise<string> {
|
|
try {
|
|
return await git(['describe', '--tags', '--abbrev=0']);
|
|
} catch (err) {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
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 getShortCommit(): Promise<string> {
|
|
return await git(['show', "--format='%h'", 'HEAD', '--quiet']);
|
|
}
|