-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
146 lines (124 loc) · 3.34 KB
/
BUILD.bazel
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@rules_task//task:defs.bzl", "cmd", "task")
load("@rules_release//release:defs.bzl", "release_manager")
package(default_visibility = ["//visibility:public"])
exports_files([
"WORKSPACE",
])
bool_flag(
name = "setup_debug_flag",
build_setting_default = False,
)
config_setting(
name = "setup_debug",
flag_values = {
"//:setup_debug_flag": "True",
},
)
sh_binary(
name = "setup_ci",
srcs = [
"setup_ci.sh",
],
)
_darwin_arm64 = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
]
_linux_amd64 = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
]
_linux_arm64 = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
]
config_setting(
name = "is_linux_amd64",
constraint_values = _linux_amd64,
)
config_setting(
name = "is_linux_arm64",
constraint_values = _linux_arm64,
)
config_setting(
name = "is_darwin_arm64",
constraint_values = _darwin_arm64,
)
platform(
name = "darwin_arm64",
constraint_values = _darwin_arm64,
)
platform(
name = "linux_amd64",
constraint_values = _linux_amd64,
)
platform(
name = "linux_arm64",
constraint_values = _linux_arm64,
)
platform(
name = "python_container_linux_amd64",
constraint_values = _linux_amd64 + [
"//tools/python:python_run_in_container",
],
)
platform(
name = "python_container_linux_arm64",
constraint_values = _linux_arm64 + [
"//tools/python:python_run_in_container",
],
)
task(
name = "push_git_changes",
cmds = [
# Ensure also untracked files are added
"git -c credential.helper= add .",
"FILES_CHANGED=$(git diff --cached --name-only)",
'if [ -z "$FILES_CHANGED" ]; then echo "Nothing to commit, working tree clean. Exitting."; exit 0; fi',
"echo Files changed:",
"echo $FILES_CHANGED",
"export OP_SERVICE_ACCOUNT_TOKEN=${ONEPASSWORD_SERVICE_ACCOUNT_TOKEN_PROD:-}",
"GIT_AUTHOR_NAME=$($OP read op://vgijssel-prod/github-git-push/username)",
"GIT_AUTHOR_EMAIL=$($OP read op://vgijssel-prod/github-git-push/email)",
"GIT_PUSH_PASSWORD=$($OP read op://vgijssel-prod/github-git-push/credential)",
"GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME",
"GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL",
"export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL",
"git -c credential.helper= commit -m 'chore(release_manager): update release files'",
"git -c credential.helper= push --tags https://$GIT_COMMITTER_NAME:$GIT_PUSH_PASSWORD@github.com/vgijssel/setup.git HEAD:master",
],
cwd = "$BUILD_WORKSPACE_DIRECTORY",
env = {
"OP": cmd.executable("//tools/onepassword:op"),
},
)
release_manager(
name = "release_manager",
publish_cmds = [
":push_git_changes",
],
deps = [
"//occupancy_component:release",
"//provisioner:release",
"//tools/bunq2ynab:release",
"@rules_release//:release",
"@rules_task//:release",
],
)
alias(
name = "regctl",
actual = "@rules_release//tools/regctl",
)
alias(
name = "tsh",
actual = "//tools/teleport:tsh",
)
alias(
name = "op",
actual = "//tools/onepassword:op",
)
alias(
name = "bazel-differ",
actual = "@rules_release//tools/bazel-differ",
)