mirror of
https://github.com/goreleaser/goreleaser-action.git
synced 2026-05-16 15:40:34 +00:00
Add tests
This commit is contained in:
parent
79b6548141
commit
bb450e4e69
29 changed files with 5069 additions and 30 deletions
|
|
@ -35,7 +35,10 @@ export async function getGoReleaser(version: string): Promise<string> {
|
|||
extPath = await tc.extractTar(`${tmpdir}/${fileName}`);
|
||||
}
|
||||
|
||||
return path.join(extPath, 'goreleaser');
|
||||
return path.join(
|
||||
extPath,
|
||||
osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'
|
||||
);
|
||||
}
|
||||
|
||||
function getFileName(): string {
|
||||
|
|
|
|||
11
src/main.ts
11
src/main.ts
|
|
@ -2,14 +2,17 @@ import * as installer from './installer';
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
async function run() {
|
||||
export async function run(silent?: boolean) {
|
||||
try {
|
||||
const version = core.getInput('version') || 'latest';
|
||||
const args = core.getInput('args');
|
||||
const goreleaser = await installer.getGoReleaser(version);
|
||||
|
||||
let snapshot = '';
|
||||
if (!process.env.GITHUB_REF!.startsWith('refs/tags/')) {
|
||||
if (
|
||||
!process.env.GITHUB_REF ||
|
||||
!process.env.GITHUB_REF.startsWith('refs/tags/')
|
||||
) {
|
||||
console.log(`⚠️ No tag found. Snapshot forced`);
|
||||
if (!args.includes('--snapshot')) {
|
||||
snapshot = ' --snapshot';
|
||||
|
|
@ -19,7 +22,9 @@ async function run() {
|
|||
}
|
||||
|
||||
console.log('🏃 Running GoReleaser...');
|
||||
await exec.exec(`${goreleaser} ${args}${snapshot}`);
|
||||
await exec.exec(`${goreleaser} ${args}${snapshot}`, undefined, {
|
||||
silent: silent
|
||||
});
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue