Skip to content

Commit

Permalink
Add install-only test job and fix action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Nov 6, 2020
1 parent 3f5ecc4 commit 3d57a20
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...`);
Expand Down

0 comments on commit 3d57a20

Please sign in to comment.