From 3205e2e6e2e6703993fc05397bed466c60b36149 Mon Sep 17 00:00:00 2001 From: ryuupendragon Date: Sat, 11 Jul 2026 10:59:52 +0530 Subject: [PATCH] add test wf --- .gitea/workflows/test.yml | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..13edc7c --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,81 @@ +name: Build and Push Docker Images + +on: + workflow_dispatch: + push: + branches: [main] + paths: + - "caddy-*/**" + - ".gitea/workflows/build-and-push.yml" + +jobs: + build: + runs-on: temp + strategy: + matrix: + variant: + - name: "cloudflare" + dockerfile: "caddy-cloudflare/Dockerfile" + context: "caddy-cloudflare" + fail-fast: true + + steps: + - name: Checkout code + uses: actions/checkout@v7.0.0 + - name: Parse Caddy version + id: version + run: | + VERSION=$(grep -m 1 -Eo 'caddy:[0-9]+\.[0-9]+\.[0-9]' caddy-cloudflare/Dockerfile | cut -d ':' -f2) + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version from file: $VERSION" + + # Extract semantic version parts + MAJOR=$(echo $VERSION | cut -d. -f1) + MINOR=$(echo $VERSION | cut -d. -f1-2) + + echo "major_version=$MAJOR" >> $GITHUB_OUTPUT + echo "minor_version=$MINOR" >> $GITHUB_OUTPUT + echo "Major: $MAJOR, Minor: $MINOR" + - name: Set up QEMU + uses: docker/setup-qemu-action@v4.2.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4.2.0 + with: + driver-opts: image=moby/buildkit:v0.23.2@sha256:ddd1ca44b21eda906e81ab14a3d467fa6c39cd73b9a39df1196210edcb8db59e + - name: Login to GitHub Container Registry + uses: docker/login-action@v4.4.0 + with: + registry: ghcr.io + username: ${{ vars.GH_USERNAME }} + password: ${{ secrets.GH_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v4.4.0 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v6.2.0 + with: + images: | + ghcr.io/${{ vars.GH_USERNAME }}/caddy-${{ matrix.variant.name }} + ${{ vars.DOCKERHUB_USERNAME }}/caddy-${{ matrix.variant.name }} + tags: | + type=sha,format=long,prefix=sha- + type=raw,value=latest + type=raw,value=${{ steps.version.outputs.major_version }} + type=raw,value=${{ steps.version.outputs.minor_version }} + type=raw,value=${{ steps.version.outputs.version }},priority=1000 + - name: Build and push + uses: docker/build-push-action@v7.3.0 + with: + context: ${{ matrix.variant.context }} + file: ${{ matrix.variant.dockerfile }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + BUILDKIT_INLINE_CACHE=1