diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-04-03 19:37:38 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2025-04-03 19:37:38 -0400 |
| commit | 253b43db44648612127e11f526c6b920f169e722 (patch) | |
| tree | a5643e24314e17a4241f1ffdcdd774abfb006002 | |
| parent | 0e442f82b054c0c2122be786d24fcbd574a85d9f (diff) | |
| download | x-253b43db44648612127e11f526c6b920f169e722.tar.xz x-253b43db44648612127e11f526c6b920f169e722.zip | |
add package build job from Anubis as a test
Signed-off-by: Xe Iaso <me@xeiaso.net>
| -rw-r--r-- | .github/workflows/package-builds.yml | 72 | ||||
| -rw-r--r-- | cmd/ingressd/yeetfile.js | 7 | ||||
| -rw-r--r-- | var/.gitignore | 2 | ||||
| -rw-r--r-- | yeetfile.js | 53 |
4 files changed, 130 insertions, 4 deletions
diff --git a/.github/workflows/package-builds.yml b/.github/workflows/package-builds.yml new file mode 100644 index 0000000..7a71696 --- /dev/null +++ b/.github/workflows/package-builds.yml @@ -0,0 +1,72 @@ +name: Package builds (stable) + +on: + release: + types: [published] + +permissions: + contents: read + actions: write + +jobs: + package_builds: + runs-on: alrest-x + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + fetch-tags: true + fetch-depth: 0 + + - name: build essential + run: | + sudo apt-get update + sudo apt-get install -y build-essential + + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Setup Homebrew cellar cache + uses: actions/cache@v4 + with: + path: | + /home/linuxbrew/.linuxbrew/Cellar + /home/linuxbrew/.linuxbrew/bin + /home/linuxbrew/.linuxbrew/etc + /home/linuxbrew/.linuxbrew/include + /home/linuxbrew/.linuxbrew/lib + /home/linuxbrew/.linuxbrew/opt + /home/linuxbrew/.linuxbrew/sbin + /home/linuxbrew/.linuxbrew/share + /home/linuxbrew/.linuxbrew/var + key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-go-homebrew-cellar- + + - name: Install Brew dependencies + run: | + brew bundle + + - name: Setup Golang caches + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-golang- + + - name: Build Packages + run: | + go run ./cmd/yeet + + - name: Upload released artifacts + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash + run: | + cd var + for file in *; do + gh release upload ${{github.event.release.tag_name}} $file + done
\ No newline at end of file diff --git a/cmd/ingressd/yeetfile.js b/cmd/ingressd/yeetfile.js index ca26fb7..7f2ad9b 100644 --- a/cmd/ingressd/yeetfile.js +++ b/cmd/ingressd/yeetfile.js @@ -5,9 +5,8 @@ license: "CC0", goarch, - build: (out) => { - go.build("-o", `${out}/usr/bin/ingressd`); - yeet.run("mkdir", "-p", `${out}/usr/lib/systemd/system`); - yeet.run("cp", "ingressd.service", `${out}/usr/lib/systemd/system/ingressd.service`); + build: ({ bin, systemd }) => { + go.build("-o", `${bin}/ingressd`); + file.install("ingressd.service", `${systemd}/ingressd.service`); }, }));
\ No newline at end of file diff --git a/var/.gitignore b/var/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/var/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore
\ No newline at end of file diff --git a/yeetfile.js b/yeetfile.js new file mode 100644 index 0000000..b60e10c --- /dev/null +++ b/yeetfile.js @@ -0,0 +1,53 @@ +["amd64", "arm64", "386"].forEach(goarch => { + [deb, rpm, tarball].forEach(method => { + method.build({ + name: "ingressd", + description: "ingress for my homelab", + homepage: "https://within.website", + license: "CC0", + goarch, + + documentation: { + "LICENSE": "LICENSE", + }, + + build: ({ bin, systemd }) => { + $`go build -o ${bin}/ingressd -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}" ./cmd/ingressd'` + file.install("./cmd/ingressd/ingressd.service", `${systemd}/ingressd.service`); + }, + }); + + method.build({ + name: "quickserv", + description: "Like python3 -m http.server but a single binary", + homepage: "https://within.website", + license: "CC0", + goarch, + + documentation: { + "LICENSE": "LICENSE", + }, + + build: ({ bin }) => { + $`go build -o ${bin}/quickserv -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}" ./cmd/quickserv'` + }, + }); + + method.build({ + name: "yeet", + description: "Yeet out actions with maximum haste!", + homepage: "https://within.website", + license: "CC0", + goarch, + + documentation: { + "./cmd/yeet/README.md": "README.md", + "LICENSE": "LICENSE", + }, + + build: ({ bin }) => { + $`CGO_ENABLED=0 go build -o ${bin}/yeet -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}" ./cmd/yeet'` + }, + }) + }); +});
\ No newline at end of file |
