mirror of
https://github.com/goreleaser/goreleaser-action.git
synced 2026-05-22 10:11:54 +00:00
Merge 8a360266f3 into 1a80836c5c
This commit is contained in:
commit
51dc7bc0a7
1 changed files with 8 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import * as crypto from 'crypto';
|
|||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import os from 'os';
|
||||
import * as context from './context';
|
||||
import * as github from './github';
|
||||
import * as core from '@actions/core';
|
||||
|
|
@ -11,6 +12,13 @@ import * as tc from '@actions/tool-cache';
|
|||
|
||||
export async function install(distribution: string, version: string): Promise<string> {
|
||||
const release: github.GitHubRelease = await github.getRelease(distribution, version);
|
||||
// check cache
|
||||
const toolDirPath = tc.find('goreleaser-action', release.tag_name.replace(/^v/, ''), os.arch());
|
||||
// If not found in cache, download
|
||||
if (toolDirPath) {
|
||||
core.info(`Found in cache @ ${toolDirPath}`);
|
||||
return path.join(toolDirPath, context.osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
|
||||
}
|
||||
const filename = getFilename(distribution);
|
||||
const baseUrl = `https://github.com/goreleaser/${distribution}/releases/download/${release.tag_name}`;
|
||||
const downloadUrl = `${baseUrl}/${filename}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue