From 6cc9a511055529cc0162ffb2eb1477fbe69cb2eb Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 28 Feb 2025 23:10:48 +0100 Subject: [PATCH] ci: Add a release workflow Signed-off-by: Gergely Nagy --- .forgejo/workflows/release.yaml | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 .forgejo/workflows/release.yaml diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..b49d782 --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -0,0 +1,134 @@ +## SPDX-FileCopyrightText: 2025 Gergely Nagy +## SPDX-FileContributor: Gergely Nagy +## +## SPDX-License-Identifier: MIT + +name: release + +on: + push: + tags: + - 'iocaine-*' + +jobs: + info: + runs-on: nixos-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: extract the version from the tag + id: version + run: | + echo "pkg-version=${GITHUB_REF_NAME//refs\/tags\/iocaine-}" >>"${GITHUB_OUTPUT}" + + binary-static: + runs-on: nixos-latest + needs: info + strategy: + matrix: + system: + - x86_64-linux + env: + PKG_VERSION: ${{ needs.info.outputs.pkg-version }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup magic attic cache + uses: actions/magic-attic-cache@main + with: + CELLAR_TOKEN: ${{ secrets.CELLAR_TOKEN }} + + - name: build + uses: actions/nix/build@main + with: + logs: true + package: packages.${{ matrix.system }}.iocaine-static + + - name: compress the binary + run: | + zstd result/bin/iocaine \ + -o iocaine-${PKG_VERSION}.${{ matrix.system }}.zst + + - name: upload package + env: + VERSION: + run: | + curl --user :${{ secrets.DOCKER_PASSWORD }} -XDELETE \ + https://git.madhouse-project.org/api/packages/iocaine/generic/iocaine-binaries/${PKG_VERSION} + curl --user :${{ secrets.DOCKER_PASSWORD }} \ + --upload-file iocaine-${PKG_VERSION}.${{ matrix.system }}.zst \ + --fail \ + https://git.madhouse-project.org/api/packages/iocaine/generic/iocaine-binaries/${PKG_VERSION}/iocaine-${PKG_VERSION}.${{ matrix.system }}.zst + + container: + runs-on: nixos-latest + needs: info + env: + PKG_VERSION: ${{ needs.info.outputs.pkg-version }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup magic attic cache + uses: actions/magic-attic-cache@main + with: + CELLAR_TOKEN: ${{ secrets.CELLAR_TOKEN }} + + - name: build the container image + uses: actions/nix/build@main + with: + logs: true + package: container-image + + - name: load the container image into docker + run: | + docker load