From dfe81dee59c2b9347b7f9aff199f9f83885d8094 Mon Sep 17 00:00:00 2001
From: Nathan Woodburn <github@nathan.woodburn.au>
Date: Tue, 25 Feb 2025 18:42:25 +1100
Subject: [PATCH] feat: Try a new build script

---
 .gitea/workflows/test_build.yml | 54 +++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 .gitea/workflows/test_build.yml

diff --git a/.gitea/workflows/test_build.yml b/.gitea/workflows/test_build.yml
new file mode 100644
index 0000000..cb812c6
--- /dev/null
+++ b/.gitea/workflows/test_build.yml
@@ -0,0 +1,54 @@
+name: Build Docker fast
+run-name: Build Docker Images fast
+on:
+  push:
+
+jobs:
+  BuildImage:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+      
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+      
+      - name: Login to Docker Registry
+        uses: docker/login-action@v2
+        with:
+          registry: git.woodburn.au
+          username: nathanwoodburn
+          password: ${{ secrets.DOCKERGIT_TOKEN }}
+      
+      - name: Extract metadata
+        id: meta
+        run: |
+          echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
+          tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
+          tag=${tag//\//-}
+          echo "tag=$tag" >> $GITHUB_OUTPUT
+          tag_num=${GITHUB_RUN_NUMBER}
+          echo "tag_num=$tag_num" >> $GITHUB_OUTPUT
+          
+          if [[ "$tag" == "main" ]]; then
+            echo "final_tag=latest" >> $GITHUB_OUTPUT
+          else
+            echo "final_tag=${tag}-${tag_num}" >> $GITHUB_OUTPUT
+          fi
+          
+          repo=$GITHUB_REPOSITORY
+          repo=${repo#*/}
+          repo=$(echo $repo | tr '[:upper:]' '[:lower:]')
+          echo "repo=$repo" >> $GITHUB_OUTPUT
+      
+      - name: Build and push
+        uses: docker/build-push-action@v4
+        with:
+          context: .
+          push: true
+          tags: |
+            git.woodburn.au/nathanwoodburn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.final_tag }}
+            git.woodburn.au/nathanwoodburn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.tag_num }}
+            git.woodburn.au/nathanwoodburn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.tag }}
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
\ No newline at end of file