diff --git a/action.yml b/action.yml index 051b0f31..4b1dfada 100644 --- a/action.yml +++ b/action.yml @@ -11,9 +11,13 @@ inputs: description: 'GoReleaser version' default: 'latest' required: false + install-only: + description: 'Just install GoReleaser' + default: false + required: false args: description: 'Arguments to pass to GoReleaser' - required: true + required: true # not required when install-only=true workdir: description: 'Working directory (below repository root)' default: '.' diff --git a/dist/index.js b/dist/index.js index 6f5d5320..50d5f7d7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -339,13 +339,22 @@ const git = __importStar(__webpack_require__(374)); const installer = __importStar(__webpack_require__(480)); const core = __importStar(__webpack_require__(186)); const exec = __importStar(__webpack_require__(514)); +const path_1 = __webpack_require__(622); function run() { return __awaiter(this, void 0, void 0, function* () { try { const version = core.getInput('version') || 'latest'; - const args = core.getInput('args', { required: true }); + const isInstallOnly = core.getInput('install-only') === 'true'; const workdir = core.getInput('workdir') || '.'; const goreleaser = yield installer.getGoReleaser(version); + core.info(`✅ GoReleaser installed successfully`); + if (isInstallOnly) { + const goreleaserDir = path_1.dirname(goreleaser); + core.addPath(goreleaserDir); + core.debug(`Added ${goreleaserDir} to PATH`); + return; + } + const args = core.getInput('args', { required: true }); if (workdir && workdir !== '.') { core.info(`📂 Using ${workdir} as working directory...`); process.chdir(workdir); diff --git a/src/main.ts b/src/main.ts index eee5af93..420a950c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,13 +2,22 @@ import * as git from './git'; import * as installer from './installer'; import * as core from '@actions/core'; import * as exec from '@actions/exec'; +import {dirname} from 'path'; async function run(): Promise { try { const version = core.getInput('version') || 'latest'; - const args = core.getInput('args', {required: true}); + const isInstallOnly = core.getInput('install-only') === 'true'; const workdir = core.getInput('workdir') || '.'; const goreleaser = await installer.getGoReleaser(version); + core.info(`✅ GoReleaser installed successfully`); + if (isInstallOnly) { + const goreleaserDir = dirname(goreleaser); + core.addPath(goreleaserDir); + core.debug(`Added ${goreleaserDir} to PATH`); + return; + } + const args = core.getInput('args', {required: true}); if (workdir && workdir !== '.') { core.info(`📂 Using ${workdir} as working directory...`);