mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-30 00:08:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a54d7e660 | ||
|
|
a59bcd6856 | ||
|
|
b59bff5dc3 | ||
|
|
b2263bd81e | ||
|
|
76bde1890b | ||
|
|
194deb5974 |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
@@ -31,6 +31,6 @@ jobs:
|
|||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
|||||||
+417
-1809
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -21,23 +21,23 @@
|
|||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.3.0",
|
"@actions/core": "^1.4.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^1.0.11",
|
||||||
"@actions/tool-cache": "^1.7.0"
|
"@actions/tool-cache": "^1.7.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.14",
|
"@types/jest": "^26.0.24",
|
||||||
"@types/node": "^14.11.2",
|
"@types/node": "^14.17.6",
|
||||||
"@vercel/ncc": "^0.24.1",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.6.0",
|
||||||
"jest": "^26.4.2",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.4.2",
|
"jest-circus": "^26.6.3",
|
||||||
"jest-runtime": "^26.4.2",
|
"jest-runtime": "^26.6.3",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.3.2",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"ts-jest": "^26.4.1",
|
"ts-jest": "^26.5.6",
|
||||||
"typescript": "^4.0.3",
|
"typescript": "^4.3.5",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
import * as actionsExec from '@actions/exec';
|
|
||||||
import {ExecOptions} from '@actions/exec';
|
|
||||||
|
|
||||||
export interface ExecResult {
|
|
||||||
success: boolean;
|
|
||||||
stdout: string;
|
|
||||||
stderr: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const exec = async (command: string, args: string[] = [], silent: boolean): Promise<ExecResult> => {
|
|
||||||
let stdout: string = '';
|
|
||||||
let stderr: string = '';
|
|
||||||
|
|
||||||
const options: ExecOptions = {
|
|
||||||
silent: silent,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
};
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
stdout += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data: Buffer) => {
|
|
||||||
stderr += data.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const returnCode: number = await actionsExec.exec(command, args, options);
|
|
||||||
|
|
||||||
return {
|
|
||||||
success: returnCode === 0,
|
|
||||||
stdout: stdout.trim(),
|
|
||||||
stderr: stderr.trim()
|
|
||||||
};
|
|
||||||
};
|
|
||||||
+12
-7
@@ -1,12 +1,17 @@
|
|||||||
import * as exec from './exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
const git = async (args: string[] = []): Promise<string> => {
|
const git = async (args: string[] = []): Promise<string> => {
|
||||||
return await exec.exec(`git`, args, true).then(res => {
|
return await exec
|
||||||
if (res.stderr != '' && !res.success) {
|
.getExecOutput(`git`, args, {
|
||||||
throw new Error(res.stderr);
|
ignoreReturnCode: true,
|
||||||
}
|
silent: true
|
||||||
return res.stdout.trim();
|
})
|
||||||
});
|
.then(res => {
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw new Error(res.stderr);
|
||||||
|
}
|
||||||
|
return res.stdout.trim();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getTag(): Promise<string> {
|
export async function getTag(): Promise<string> {
|
||||||
|
|||||||
+2
-3
@@ -15,7 +15,6 @@ export async function getGoReleaser(distribution: string, version: string): Prom
|
|||||||
throw new Error(`Cannot find GoReleaser ${version} release`);
|
throw new Error(`Cannot find GoReleaser ${version} release`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`✅ GoReleaser version found: ${release.tag_name}`);
|
|
||||||
const filename = getFilename(distribution);
|
const filename = getFilename(distribution);
|
||||||
const downloadUrl = util.format(
|
const downloadUrl = util.format(
|
||||||
'https://github.com/goreleaser/%s/releases/download/%s/%s',
|
'https://github.com/goreleaser/%s/releases/download/%s/%s',
|
||||||
@@ -24,11 +23,11 @@ export async function getGoReleaser(distribution: string, version: string): Prom
|
|||||||
filename
|
filename
|
||||||
);
|
);
|
||||||
|
|
||||||
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
core.info(`Downloading ${downloadUrl}`);
|
||||||
const downloadPath: string = await tc.downloadTool(downloadUrl);
|
const downloadPath: string = await tc.downloadTool(downloadUrl);
|
||||||
core.debug(`Downloaded to ${downloadPath}`);
|
core.debug(`Downloaded to ${downloadPath}`);
|
||||||
|
|
||||||
core.info('📦 Extracting GoReleaser...');
|
core.info('Extracting GoReleaser');
|
||||||
let extPath: string;
|
let extPath: string;
|
||||||
if (osPlat == 'win32') {
|
if (osPlat == 'win32') {
|
||||||
extPath = await tc.extractZip(downloadPath);
|
extPath = await tc.extractZip(downloadPath);
|
||||||
|
|||||||
+6
-6
@@ -12,7 +12,7 @@ async function run(): Promise<void> {
|
|||||||
const workdir = core.getInput('workdir') || '.';
|
const workdir = core.getInput('workdir') || '.';
|
||||||
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
||||||
const goreleaser = await installer.getGoReleaser(distribution, version);
|
const goreleaser = await installer.getGoReleaser(distribution, version);
|
||||||
core.info(`✅ GoReleaser installed successfully`);
|
core.info(`GoReleaser ${version} installed successfully`);
|
||||||
|
|
||||||
if (isInstallOnly) {
|
if (isInstallOnly) {
|
||||||
const goreleaserDir = dirname(goreleaser);
|
const goreleaserDir = dirname(goreleaser);
|
||||||
@@ -20,11 +20,12 @@ async function run(): Promise<void> {
|
|||||||
core.debug(`Added ${goreleaserDir} to PATH`);
|
core.debug(`Added ${goreleaserDir} to PATH`);
|
||||||
return;
|
return;
|
||||||
} else if (!args) {
|
} else if (!args) {
|
||||||
throw new Error('args input required');
|
core.setFailed('args input required');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workdir && workdir !== '.') {
|
if (workdir && workdir !== '.') {
|
||||||
core.info(`📂 Using ${workdir} as working directory...`);
|
core.info(`Using ${workdir} as working directory`);
|
||||||
process.chdir(workdir);
|
process.chdir(workdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,16 +36,15 @@ async function run(): Promise<void> {
|
|||||||
let snapshot = '';
|
let snapshot = '';
|
||||||
if (args.split(' ').indexOf('release') > -1) {
|
if (args.split(' ').indexOf('release') > -1) {
|
||||||
if (isTagDirty) {
|
if (isTagDirty) {
|
||||||
core.info(`⚠️ No tag found for commit ${commit}. Snapshot forced`);
|
core.info(`No tag found for commit ${commit}. Snapshot forced`);
|
||||||
if (!args.includes('--snapshot')) {
|
if (!args.includes('--snapshot')) {
|
||||||
snapshot = ' --snapshot';
|
snapshot = ' --snapshot';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
core.info(`✅ ${tag} tag found for commit ${commit}`);
|
core.info(`${tag} tag found for commit ${commit}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info('🏃 Running GoReleaser...');
|
|
||||||
if (!('GORELEASER_CURRENT_TAG' in process.env)) {
|
if (!('GORELEASER_CURRENT_TAG' in process.env)) {
|
||||||
process.env.GORELEASER_CURRENT_TAG = tag;
|
process.env.GORELEASER_CURRENT_TAG = tag;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user