mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-07-08 22:07:31 +00:00
Artifact signing (#2)
This commit is contained in:
+11
@@ -1,11 +1,13 @@
|
||||
import * as installer from './installer';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export async function run(silent?: boolean) {
|
||||
try {
|
||||
const version = core.getInput('version') || 'latest';
|
||||
const args = core.getInput('args');
|
||||
const key = core.getInput('key');
|
||||
const goreleaser = await installer.getGoReleaser(version);
|
||||
|
||||
let snapshot = '';
|
||||
@@ -21,6 +23,15 @@ export async function run(silent?: boolean) {
|
||||
console.log(`✅ ${process.env.GITHUB_REF!.split('/')[2]} tag found`);
|
||||
}
|
||||
|
||||
if (key) {
|
||||
console.log('🔑 Importing signing key...');
|
||||
let path = `${process.env.HOME}/key.asc`;
|
||||
fs.writeFileSync(path, key, {mode: 0o600})
|
||||
await exec.exec('gpg', ['--import', path], {
|
||||
silent: silent
|
||||
})
|
||||
}
|
||||
|
||||
console.log('🏃 Running GoReleaser...');
|
||||
await exec.exec(`${goreleaser} ${args}${snapshot}`, undefined, {
|
||||
silent: silent
|
||||
|
||||
Reference in New Issue
Block a user