-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEufile
86 lines (71 loc) · 2.25 KB
/
Eufile
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
{
doc: "Build-related transformations for eucalypt"
import: "cargo=Cargo.toml"
}
` "eucalypt version according to Cargo.toml"
version:
cargo.package.version
str.match-with("(\d+)\.(\d+)\.([^.]+)")
drop(1)
map(num)
with-keys([:major, :minor, :patch])
merge({ build: :dev})
` "Default an environment that looks close to github actions
environment, even locally"
env:
{
GITHUB_SERVER_URL: "https://github.com"
GITHUB_REPOSITORY: "curvelogic/eucalypt"
GITHUB_RUN_ID: 0
GITHUB_RUN_NUMBER: version.build
GITHUB_SHA: "working-copy"
} io.env
` "URL for this workflow run"
workflow-url:
[:GITHUB_SERVER_URL, :GITHUB_REPOSITORY, :GITHUB_RUN_ID]
map(lookup-in(env))
apply("{0}/{1}/runs/{2}")
build: {
` "Eucalypt build number"
number: env.GITHUB_RUN_NUMBER
` "SHA1 of the repo commit we're building"
commit: env.GITHUB_SHA
` "URL of build"
url: workflow-url
` "Architecture of build environment"
arch: env lookup-alts([:HOSTTYPE, :_system_arch], "unknown")
` "Architecture of build environment"
os: env lookup-alts([:OSTYPE, :_system_name], "unknown")
` "Seconds since epoch at eu build time"
epoch-time: io.epoch-time
` "GitHub environment variables"
github-env: env filter-items(by-key-match("^GITHUB.*")) block
}
` {target: :version
format: :text
doc: "version number for the current build"}
new-version: [version.major,
version.minor,
version.patch,
build.number] map(str.of) str.join-on(".")
` {target: :build-meta
doc: "build metadata to embed as resource in binary"}
build-meta: {
version: new-version
commit: build.commit
url: build.url
banner: "eu - Eucalypt (Rust Impl: v{version})"
eu-build: build
}
` {target: :cargo
format: :toml
doc: "updated Cargo.toml with new version number"}
new-package: cargo { package: { version: new-version } }
` { target: :formula-sh
format: :text
doc: "Shell incantation to generate homebrew forumula for latest release"}
formula-sh: "
curl https://api.github.com/repos/curvelogic/eucalypt/releases/latest > latest.json
curl -L $(cat latest.json | eu - ci/formula.eu -t latest-asset-url) | shasum -a 256 > shasum.txt
eu -t formula shasum=shasum.txt latest=latest.json ci/formula.eu
"