XR packaging for Fedora Atomic
1#!/usr/bin/env nu
2# SPDX-License-Identifier: AGPL-3.0-only
3# SPDX-FileCopyrightText: MatrixFurry <did:plc:zmjoeu3stwcn44647rhxa44o>
4
5# TODO: Rewrite this in Ruby or Bash so CI doesn't have to install Nushell
6def main [
7 formula: string
8 --token (-t): string # GitLab deploy token
9 --verbose (-v)
10 --no-rebuild (-r)
11] {
12 cd (mktemp -dt)
13
14 let token = $token | default $env.DEPLOY_TOKEN?
15 if ($token | is-empty) {
16 error make {
17 msg: "Either --token or $env.DEPLOY_TOKEN is required"
18 }
19 }
20
21 mut bottle_args = []
22 mut install_args = []
23
24 if $verbose {
25 $install_args ++= ["--verbose"]
26 }
27
28 if $no_rebuild {
29 $bottle_args ++= ["--no-rebuild"]
30 }
31
32 let version = brew info $formula --json | from json | get versions.stable.0
33
34 brew install --build-bottle --bottle-arch "x86-64-v3" ...$install_args $formula
35 brew bottle --root-url $"https://gitlab.com/api/v4/projects/75293878/packages/generic/($formula)/($version)" --json ...$bottle_args $formula
36 brew bottle --merge --json $"($formula)--($version).x86_64_linux.bottle.json"
37
38 open --raw $"($formula)--($version).x86_64_linux.bottle.tar.gz"
39 | into binary
40 | http put --content-type application/gzip $"https://gitlab.com/api/v4/projects/75293878/packages/generic/($formula)/($version)/($formula)-($version).x86_64_linux.bottle.tar.gz" -H {DEPLOY-TOKEN: $token}
41}