Merge pull request #22 from fbrinker/fix-hugo-extended-version

#21 Fix empty version in download with buildInVersion fallback
This commit is contained in:
Thomas Boerger 2019-11-21 09:09:21 +01:00 committed by GitHub
commit 8a8184da98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/drone-plugins/drone-hugo/download"
"os"
"os/exec"
"strings"
"github.com/drone-plugins/drone-hugo/download"
)
type (
@ -41,7 +42,12 @@ func (p Plugin) Exec() error {
// Check if buildIn plugin version equals
// plugin version declared in drone.yml
if !versionsEqual(p.BuildInVersion, p.Config.HugoVersion, p.Config.HugoExtended) {
hugoPath, err := download.Get(p.Config.HugoVersion, p.Config.HugoExtended)
hugoVersion := p.Config.HugoVersion
if hugoVersion == "" {
hugoVersion = p.BuildInVersion
}
hugoPath, err := download.Get(hugoVersion, p.Config.HugoExtended)
if err != nil {
return err
}