-
Notifications
You must be signed in to change notification settings - Fork 0
/
go-module.toml
48 lines (42 loc) · 1.34 KB
/
go-module.toml
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
44
45
46
47
48
# The values of the env can dynamically be obtained from some predefined
# attributes of the repository, such as the repository name and owner.
env = [
{name = "REPO_REMOTE", from_repo = "clone"},
{name = "REPO_OWNER", from_repo = "owner"},
{name = "REPO_NAME", from_repo = "name"}
]
# Indicates an execution step in Workflow, which can be writing a file or
# executing a shell command.
[[steps]]
# The types of steps are diverse, allowing the execution of various
# commands. They also support adding various conditions, setting
# environment variables, etc. It serves as a lightweight local CI system.
# For more details, please refer to the relevant documentation on
# workflows.
# The below is a simple example that utilizes some features of the
# workflow to initialize different Go module names for different
# remotes.
name = "Test module"
condition = [
{env = "REPO_REMOTE", exists = false}
]
set_env = {name = "MODULE_NAME", value = "test-${REPO_NAME}"}
[[steps]]
name = "Module"
condition = [
{env = "REPO_REMOTE", exists = true}
]
set_env = {name = "MODULE_NAME", value = "${REPO_REMOTE}/${REPO_OWNER}/${REPO_NAME}"}
[[steps]]
# Write file to repository, path is the step name.
name = "main.go"
file = """
package main
import "fmt"
func main() {
\tfmt.Println("hello, world!")
}
"""
[[steps]]
name = "Init go module"
run = "go mod init ${REPO_NAME}"