mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-07-08 23:27:28 +00:00
feat: Use native GitHub Action tools to download assets and use GitHub API (#187)
* 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>
This commit is contained in:
+15
-13
@@ -1,12 +1,22 @@
|
||||
import * as child_process from 'child_process';
|
||||
import * as exec from './exec';
|
||||
|
||||
const git = async (args: string[] = []) => {
|
||||
const stdout = child_process.execSync(`git ${args.join(' ')}`, {
|
||||
encoding: 'utf8'
|
||||
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();
|
||||
});
|
||||
return 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]);
|
||||
@@ -16,14 +26,6 @@ export async function isTagDirty(currentTag: string): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function getTag(): Promise<string> {
|
||||
try {
|
||||
return await git(['describe', '--tags', '--abbrev=0']);
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export async function getShortCommit(): Promise<string> {
|
||||
return await git(['show', "--format='%h'", 'HEAD', '--quiet']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user