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

View File

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