.github
actions
build-container
build-release
workflows
licence-bundler
···
58
58
shell: bash
59
59
id: versions
60
60
run: |
61
61
-
# Strip `v` prefix from version
62
62
-
BARE_VERSION=$(echo "$VERSION" | sed -e 's|^v/\(.*\)|\1|')
63
63
-
64
61
# Build version with platform
65
65
-
PLATFORM_VERSION=$BARE_VERSION-${{ matrix.base-image }}
62
62
+
PLATFORM_VERSION=$VERSION_VERSION-${{ matrix.base-image }}
66
63
67
64
# Build container tag
68
65
TAG=ghcr.io/${{ github.repository }}:$PLATFORM_VERSION
···
17
17
description: "Expected Binary Architecture"
18
18
required: false
19
19
default: ""
20
20
+
generate-gleam-licences-html:
21
21
+
description: "Generate gleam-licences.html"
22
22
+
required: false
23
23
+
default: "false"
20
24
azure-tenant-id:
21
25
description: "Azure Tenant ID for Windows Code Signing"
22
26
required: false
···
34
38
required: false
35
39
36
40
outputs:
37
37
-
archive:
38
38
-
description: "Path to build asset"
39
39
-
value: "${{ steps.build.outputs.archive }}"
40
41
files:
41
42
description: "Path to all files"
42
43
value: |
···
46
47
${{ steps.build.outputs.archive }}.sigstore
47
48
${{ steps.build.outputs.archive }}.sbom.spdx.json
48
49
${{ steps.build.outputs.archive }}.sbom.cyclonedx.json
50
50
+
${{ inputs.generate-gleam-licences-html == 'true' && 'gleam-licences.html' || '' }}
49
51
50
52
runs:
51
53
using: "composite"
···
183
185
TARGET: "${{ inputs.target }}"
184
186
ARCHIVE: "${{ steps.build.outputs.archive }}"
185
187
188
188
+
- name: Install Erlang
189
189
+
if: ${{ inputs.generate-gleam-licences-html == 'true' }}
190
190
+
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
191
191
+
with:
192
192
+
otp-version: "28.0.1"
193
193
+
rebar3-version: "3"
194
194
+
195
195
+
- name: Generate licences HTML
196
196
+
if: ${{ inputs.generate-gleam-licences-html == 'true' }}
197
197
+
shell: bash
198
198
+
working-directory: licence-bundler
199
199
+
run: |
200
200
+
case "$TARGET" in
201
201
+
wasm*)
202
202
+
echo "error: cannot generate gleam-licences.html from a wasm build"
203
203
+
exit 1
204
204
+
;;
205
205
+
*windows*)
206
206
+
../target/"$TARGET"/release/gleam.exe run
207
207
+
;;
208
208
+
*)
209
209
+
../target/"$TARGET"/release/gleam run
210
210
+
;;
211
211
+
esac
212
212
+
env:
213
213
+
TARGET: "${{ inputs.target }}"
214
214
+
186
215
# By using `cargo-sbom``, we create two formats of Build SBoMs
187
216
# (SPDX and CycloneDX) for the gleam build.
188
217
# We store those files alongside the build artifacts on the GitHub Release
···
261
290
${{ steps.build.outputs.archive }}.sigstore
262
291
${{ steps.build.outputs.archive }}.sbom.spdx.json
263
292
${{ steps.build.outputs.archive }}.sbom.cyclonedx.json
293
293
+
${{ inputs.generate-gleam-licences-html == 'true' && 'gleam-licences.html' || '' }}
264
294
overwrite: true
···
110
110
target: ${{ matrix.target }}
111
111
cargo-tool: ${{ matrix.cargo-tool }}
112
112
expected-binary-architecture: ${{ matrix.expected-binary-architecture }}
113
113
+
generate-gleam-licences-html: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
113
114
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
114
115
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
115
116
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
···
72
72
target: ${{ matrix.target }}
73
73
cargo-tool: ${{ matrix.cargo-tool }}
74
74
expected-binary-architecture: ${{ matrix.expected-binary-architecture }}
75
75
+
generate-gleam-licences-html: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
75
76
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
76
77
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
77
78
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
···
8
8
*.lock
9
9
node_modules/
10
10
compiler-cli/build/
11
11
-
licences.html
11
11
+
gleam-licences.html
···
1
1
name = "licence_bundler"
2
2
version = "1.0.0"
3
3
4
4
-
# Fill out these fields if you intend to generate HTML documentation or publish
5
5
-
# your project to the Hex package manager.
6
6
-
#
7
7
-
# description = ""
8
8
-
# licences = ["Apache-2.0"]
9
9
-
# repository = { type = "github", user = "", repo = "" }
10
10
-
# links = [{ title = "Website", href = "" }]
11
11
-
#
12
12
-
# For a full reference of all the available options, you can have a look at
13
13
-
# https://gleam.run/writing-gleam/gleam-toml/.
14
14
-
15
4
[dependencies]
16
5
gleam_stdlib = ">= 0.70.0 and < 2.0.0"
17
6
simplifile = ">= 2.4.0 and < 3.0.0"
18
7
shellout = ">= 1.8.0 and < 2.0.0"
19
8
tom = ">= 2.0.2 and < 3.0.0"
20
9
htmb = ">= 2.1.0 and < 3.0.0"
21
21
-
argv = ">= 1.0.2 and < 2.0.0"
22
10
23
11
[dev_dependencies]
24
12
gleeunit = ">= 1.0.0 and < 2.0.0"
···
2
2
# You typically do not need to edit this file
3
3
4
4
packages = [
5
5
-
{ name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" },
6
5
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
7
6
{ name = "gleam_stdlib", version = "0.71.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "702F3BC2A14793906880B1078B19A6165F87323AEE8D0C4A34085846336FCAAE" },
8
7
{ name = "gleam_time", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "533D8723774D61AD4998324F5DD1DABDCDBFABAFB9E87CB5D03C6955448FC97D" },
···
14
13
]
15
14
16
15
[requirements]
17
17
-
argv = { version = ">= 1.0.2 and < 2.0.0" }
18
16
gleam_stdlib = { version = ">= 0.70.0 and < 2.0.0" }
19
17
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
20
18
htmb = { version = ">= 2.1.0 and < 3.0.0" }
···
1
1
-
import argv
2
1
import gleam/bool
2
2
+
import gleam/io
3
3
import gleam/list
4
4
import gleam/result
5
5
import gleam/set.{type Set}
···
13
13
pub fn main() -> Nil {
14
14
let gleam_crates = determine_gleam_crates()
15
15
let active_licences = determine_licences()
16
16
-
let assert [output_path] = argv.load().arguments
17
17
-
as "USAGE: gleam run out/licences.html"
18
18
-
assert string.ends_with(output_path, ".html")
19
19
-
as "Output path should end with .html"
20
16
21
17
let assert Ok(output) =
22
18
shellout.command(
···
106
102
|> htmb.render_page
107
103
|> string_tree.to_string
108
104
109
109
-
let assert Ok(_) = simplifile.write(output_path, html)
105
105
+
let assert Ok(_) = simplifile.write("../gleam-licences.html", html)
106
106
+
io.println("Written ../gleam-licences.html")
110
107
111
108
Nil
112
109
}