mirror of
https://github.com/goreleaser/goreleaser-action.git
synced 2026-05-20 09:21:53 +00:00
Add tests
This commit is contained in:
parent
79b6548141
commit
bb450e4e69
29 changed files with 5069 additions and 30 deletions
|
|
@ -45,7 +45,7 @@ function getGoReleaser(version) {
|
|||
else {
|
||||
extPath = yield tc.extractTar(`${tmpdir}/${fileName}`);
|
||||
}
|
||||
return path.join(extPath, 'goreleaser');
|
||||
return path.join(extPath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
|
||||
});
|
||||
}
|
||||
exports.getGoReleaser = getGoReleaser;
|
||||
|
|
|
|||
10
lib/main.js
10
lib/main.js
|
|
@ -19,14 +19,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const installer = __importStar(require("./installer"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
function run() {
|
||||
function run(silent) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const version = core.getInput('version') || 'latest';
|
||||
const args = core.getInput('args');
|
||||
const goreleaser = yield 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';
|
||||
|
|
@ -36,11 +37,14 @@ function run() {
|
|||
console.log(`✅ ${process.env.GITHUB_REF.split('/')[2]} tag found`);
|
||||
}
|
||||
console.log('🏃 Running GoReleaser...');
|
||||
yield exec.exec(`${goreleaser} ${args}${snapshot}`);
|
||||
yield exec.exec(`${goreleaser} ${args}${snapshot}`, undefined, {
|
||||
silent: silent
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
run();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue