goreleaser-action/src/main.ts

27 lines
760 B
TypeScript
Raw Normal View History

2019-09-20 20:23:45 +00:00
import * as installer from './installer';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
async function run() {
try {
const version = core.getInput('version') || 'latest';
const args = core.getInput('args');
const goreleaser = await installer.getGoReleaser(version);
2019-09-20 21:08:16 +00:00
let snapshot = '';
if (!process.env.GITHUB_REF!.startsWith('refs/tags/')) {
console.log(`⚠️ No tag found. Snapshot forced`);
snapshot = ' --snapshot';
} else {
console.log(`${process.env.GITHUB_REF!.split('/')[2]}} tag found`);
}
2019-09-20 20:23:45 +00:00
console.log('🏃 Running GoReleaser...');
2019-09-20 21:08:16 +00:00
await exec.exec(`${goreleaser} ${args}${snapshot}`);
2019-09-20 20:23:45 +00:00
} catch (error) {
core.setFailed(error.message);
}
}
run();