-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
43 lines (36 loc) · 1014 Bytes
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package internal
import (
"fmt"
"github.com/CircleCI-Public/circleci-config/config"
"github.com/CircleCI-Public/circleci-config/labeling/labels"
"path/filepath"
)
const defaultCheckoutDir = "~/project"
func checkoutStep(depsLabel labels.Label) config.Step {
if depsLabel.BasePath == "." {
return config.Step{Type: config.Checkout}
}
return config.Step{
Type: config.Checkout,
Path: defaultCheckoutDir,
}
}
func workingDirectory(depsLabel labels.Label) string {
if depsLabel.BasePath == "." {
return "."
}
return filepath.Join(defaultCheckoutDir, depsLabel.BasePath)
}
const artifactsPath = "~/artifacts"
var createArtifactsDirStep = config.Step{
Type: config.Run,
Name: fmt.Sprintf("Create the %s directory if it doesn't exist", artifactsPath),
Command: fmt.Sprintf("mkdir -p %s", artifactsPath),
}
func storeArtifactsStep(destination string) config.Step {
return config.Step{
Type: config.StoreArtifacts,
Path: artifactsPath,
Destination: destination,
}
}