From d2e0d1e3b722ad58fe62e738b899e008b006b119 Mon Sep 17 00:00:00 2001 From: Torben Nehmer Date: Sun, 19 Jul 2026 10:56:12 +0200 Subject: [PATCH] feat(ci): add build and push container image workflow --- .gitea/workflows/binford-build.yaml | 4 +- .gitea/workflows/binford-release.yaml | 94 +++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/binford-release.yaml diff --git a/.gitea/workflows/binford-build.yaml b/.gitea/workflows/binford-build.yaml index 8cc2950..b21a67d 100644 --- a/.gitea/workflows/binford-build.yaml +++ b/.gitea/workflows/binford-build.yaml @@ -50,6 +50,6 @@ jobs: - name: Paket als Artefakt hochladen uses: actions/upload-artifact@v3 with: - name: gitea-mcp-auth-proxy-linux-amd64 - path: dist/authproxy + name: gitea-mcp-linux-amd64 + path: gitea.com/gitea/gitea-mcp retention-days: 7 \ No newline at end of file diff --git a/.gitea/workflows/binford-release.yaml b/.gitea/workflows/binford-release.yaml new file mode 100644 index 0000000..fb515d9 --- /dev/null +++ b/.gitea/workflows/binford-release.yaml @@ -0,0 +1,94 @@ +name: Build and Push Container Image + +on: + workflow_dispatch: + inputs: + target_branch: + description: 'Branch to build' + required: true + +env: + REGISTRY: gitea.nehmer.net/torben + IMAGE_NAME: gitea-mcp + +jobs: + build-and-push-image: + runs-on: container-builder + container: + image: debian:trixie-slim + env: + GOPROXY: https://gitea.nehmer.net/api/packages/torben/go,https://proxy.golang.org,direct + steps: + - name: Install CI Dependencies + run: | + apt-get update + apt-get install -y --no-install-recommends git nodejs curl docker-cli docker-buildx unzip ca-certificates iproute2 gawk + + - name: Checkout Code + uses: actions/checkout@v7 + with: + ref: ${{ inputs.target_branch }} + fetch-depth: 0 + + + - name: Load Secrets from 1Password + uses: 1password/load-secrets-action@v2 + with: + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + REGISTRY_USER: op://CI-CD/gitea-package-token/username + REGISTRY_PAT: op://CI-CD/gitea-package-token/password + + - name: BuildKit Setup (Remote Builder konfigurieren) + run: | + HOST_IP=$(ip route | awk '/default/ { print $3 }') + docker buildx create --name remote-builder --driver remote tcp://$HOST_IP:1234 --use --bootstrap + + - name: Log in to the Container registry + run: | + echo "$REGISTRY_PAT" | docker login $REGISTRY -u "$REGISTRY_USER" --password-stdin + + + - name: Get Meta + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/-/+/' | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-server:${{ inputs.target_branch }} + build-args: | + VERSION=${{ steps.meta.outputs.REPO_VERSION }} + + # - name: Build and Push + # run: | + # TAG="${{ gitea.ref_name }}" + + # # Note: This repository only builds and pushes images. + # # FluxCD Image Automation in another repository performs deployment. + # # Stable tags (vX.Y.Z) also publish :latest. + # # Pre-release tags (e.g. vX.Y.Z-rc1) also publish :prerelease-tag. + # if printf '%s' "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + # docker buildx build \ + # --platform linux/amd64 \ + # --push \ + # --tag "$REGISTRY/$IMAGE_NAME:$TAG" \ + # --tag "$REGISTRY/$IMAGE_NAME:latest" \ + # . + # else + # docker buildx build \ + # --platform linux/amd64 \ + # --push \ + # --tag "$REGISTRY/$IMAGE_NAME:$TAG" \ + # --tag "$REGISTRY/$IMAGE_NAME:prerelease-tag" \ + # . + # fi