From a932279a10a5a606adb9fcadb663996cbae419e8 Mon Sep 17 00:00:00 2001 From: HaimKortovich Date: Tue, 31 Mar 2026 15:34:34 -0500 Subject: [PATCH] add workflow and fix hash --- .gitea/workflows/build-and-publish.yaml | 66 +++++++++++++++++++++++++ build/flake.lock | 6 +-- build/flake.nix | 2 +- 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/build-and-publish.yaml diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml new file mode 100644 index 0000000..8401c0c --- /dev/null +++ b/.gitea/workflows/build-and-publish.yaml @@ -0,0 +1,66 @@ +name: Build and Publish + +on: + push: + branches: + - main + +env: + REGISTRY: ${{ format('{0}', replace(replace(github.server_url, 'https://', ''), 'http://', '')) }} + # Dynamically extracts just the repository name (e.g., 'my-repo' from 'owner/my-repo') + CHART_NAME: ${{ github.event.repository.name }} + IMAGE_NAME: ${{ github.event.repository.name }} + +jobs: + build-release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v26 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: Build Docker Image via Nix Flake + run: | + nix build ./build/#dockerImage + docker load -i result + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag and Push Docker Image + run: | + VERSION=${{ github.run_number }} + TARGET_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Replace 'nix-built-image:latest' with your flake's internal image name + docker tag nix-built-image:latest $TARGET_IMAGE:$VERSION + docker push $TARGET_IMAGE:$VERSION + + - name: Setup Helm + uses: azure/setup-helm@v4 + with: + version: v3.14.0 + + - name: Package Helm Chart + run: | + VERSION=${{ github.run_number }} + # Packages the chart using the dynamically injected repo name + helm package ops/chart --version $VERSION --app-version $VERSION + +- name: Push Helm Chart to Gitea Registry + run: | + VERSION=${{ github.run_number }} + CHART_FILE=${{ env.CHART_NAME }}-${VERSION}.tgz + + curl --user "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \ + -X POST \ + --upload-file ./$CHART_FILE \ + "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/helm/api/charts" diff --git a/build/flake.lock b/build/flake.lock index abf6f02..2e9c99c 100644 --- a/build/flake.lock +++ b/build/flake.lock @@ -32,11 +32,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1743448293, - "narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=", + "lastModified": 1774709303, + "narHash": "sha256-D3Q07BbIA2KnTcSXIqqu9P586uWxN74zNoCH3h2ESHg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3", + "rev": "8110df5ad7abf5d4c0f6fb0f8f978390e77f9685", "type": "github" }, "original": { diff --git a/build/flake.nix b/build/flake.nix index 7306168..dbbeffd 100644 --- a/build/flake.nix +++ b/build/flake.nix @@ -16,7 +16,7 @@ version = "0.0.0"; src = ../src; doCheck = false; - vendorHash = "sha256-HEXIHASdDC7chG9uF56f6pvZPVbxYs/fWFytDz6CAf4="; + vendorHash = "sha256-4XOlUsbFNtq0TvQMtqiTgZtWV8Q6snwZiS4oCuhL2nw="; installPhase = '' runHook preInstall