Files
goreleaser-action/src/main.ts
T
2019-09-20 23:08:16 +02:00

27 lines
760 B
TypeScript

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);
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`);
}
console.log('🏃 Running GoReleaser...');
await exec.exec(`${goreleaser} ${args}${snapshot}`);
} catch (error) {
core.setFailed(error.message);
}
}
run();