feat: Add install-only test job and fix action.yml

This commit is contained in:
CrazyMax 2020-11-06 21:23:29 +01:00
commit d0f90f55ae
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
4 changed files with 45 additions and 9 deletions

View File

@ -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'

View File

@ -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'

7
dist/index.js generated vendored
View File

@ -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);

View File

@ -7,17 +7,20 @@ import {dirname} from 'path';
async function run(): Promise<void> {
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...`);