From 3d57a2062133425cfe35ca0813024fa17dd71847 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 6 Nov 2020 21:18:48 +0100 Subject: [PATCH] Add install-only test job and fix action.yml --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ action.yml | 10 +++++----- dist/index.js | 7 +++++-- src/main.ts | 7 +++++-- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13df203..e6f432e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,36 @@ jobs: version: ${{ matrix.version }} args: release --skip-publish --rm-dist + install-only: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - latest + - v0.117.0 + steps: + - + name: Checkout + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: GoReleaser + uses: ./ + with: + version: ${{ matrix.version }} + install-only: true + - + name: Check + run: | + goreleaser check --debug + signing: runs-on: ${{ matrix.os }} if: github.event_name != 'pull_request' diff --git a/action.yml b/action.yml index 7492944..9f18e85 100644 --- a/action.yml +++ b/action.yml @@ -11,17 +11,17 @@ 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 # not required when install-only=true + required: false workdir: description: 'Working directory (below repository root)' default: '.' required: false + install-only: + description: 'Just install GoReleaser' + default: 'false' + required: false runs: using: 'node12' diff --git a/dist/index.js b/dist/index.js index 7bb7770..d6f3a1a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -344,8 +344,9 @@ function run() { return __awaiter(this, void 0, void 0, function* () { try { const version = core.getInput('version') || 'latest'; - const isInstallOnly = /^true$/i.test(core.getInput('install-only')); + const args = core.getInput('args'); const workdir = core.getInput('workdir') || '.'; + const isInstallOnly = /^true$/i.test(core.getInput('install-only')); const goreleaser = yield installer.getGoReleaser(version); core.info(`✅ GoReleaser installed successfully`); if (isInstallOnly) { @@ -354,7 +355,9 @@ function run() { core.debug(`Added ${goreleaserDir} to PATH`); return; } - const args = core.getInput('args', { required: true }); + else if (!args) { + throw new Error('args input required'); + } if (workdir && workdir !== '.') { core.info(`📂 Using ${workdir} as working directory...`); process.chdir(workdir); diff --git a/src/main.ts b/src/main.ts index 33dcc5b..194039c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,17 +7,20 @@ import {dirname} from 'path'; async function run(): Promise { try { const version = core.getInput('version') || 'latest'; - const isInstallOnly = /^true$/i.test(core.getInput('install-only')); + const args = core.getInput('args'); const workdir = core.getInput('workdir') || '.'; + const isInstallOnly = /^true$/i.test(core.getInput('install-only')); 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; + } else if (!args) { + throw new Error('args input required'); } - const args = core.getInput('args', {required: true}); if (workdir && workdir !== '.') { core.info(`📂 Using ${workdir} as working directory...`);