From ca1a3eb22aade41bfdf2d3a7dc048a028f64aeda Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 29 Jan 2025 08:16:36 +0100 Subject: [PATCH] ci: build & publish a static binary too Signed-off-by: Gergely Nagy --- .forgejo/workflows/build.yaml | 53 ++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 8bcd663..c0a3f3c 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -19,7 +19,7 @@ on: - 'templates/**' jobs: - build: + binary: runs-on: nixos-latest steps: - name: checkout @@ -36,6 +36,57 @@ jobs: logs: true package: iocaine + binary-static: + runs-on: nixos-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup magic attic cache + uses: actions/magic-attic-cache@main + with: + ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} + + - name: build + uses: actions/nix/build@main + with: + logs: true + package: iocaine-static + + - name: compress the binary + uses: actions/nix/develop@main + with: + run: | + zstd result/bin/iocaine + + - name: determine the version + uses: actions/nix/develop@main + id: ver + with: + run: | + echo "ver=$(cargo info -q iocaine | grep "^version:" | cut -d " " -f 2)" >>"${GITHUB_OUTPUT}"" + + - name: upload package + uses: actions/nix/develop@main + with: + run: | + curl --user :${{ secrets.DOCKER_PASSWORD }} -XDELETE \ + https://git.madhouse-project.org/api/packages/algernon/generic/iocaine/${{ steps.ver.outputs.ver }} + curl --user :${{ secrets.DOCKER_PASSWORD }} \ + --upload-file result/bin/iocaine.zstd \ + https://git.madhouse-project.org/api/packages/algernon/generic/iocaine/${{ steps.ver.outputs.ver }}/iocaine.zstd + + container: + runs-on: nixos-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup magic attic cache + uses: actions/magic-attic-cache@main + with: + ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} + - name: build the container image uses: actions/nix/build@main with: