mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-18 08:26:45 +02:00
492ac956ca
Fixed the WriteEnv usage and updated to allow for sudo if necessary.
22 lines
567 B
Go
22 lines
567 B
Go
package deploy
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/drone/drone/pkg/build/buildfile"
|
|
)
|
|
|
|
type Modulus struct {
|
|
Project string `yaml:"project,omitempty"`
|
|
Token string `yaml:"token,omitempty"`
|
|
}
|
|
|
|
func (m *Modulus) Write(f *buildfile.Buildfile) {
|
|
f.WriteEnv("MODULUS_TOKEN", m.Token)
|
|
|
|
// Install the Modulus command line interface then deploy the configured
|
|
// project.
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] || npm install -g modulus")
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo npm install -g modulus")
|
|
f.WriteCmd(fmt.Sprintf("modulus deploy -p '%s'", m.App))
|
|
}
|