From 738307d070b814feb379cadaa3caaf970f9495d5 Mon Sep 17 00:00:00 2001
From: Kieron Morris <kjm@kieronmorris.me>
Date: Sun, 9 Mar 2025 20:30:45 +0000
Subject: [PATCH] Testing artefact upload

- Testing the upload of the resulting `Asuro.iso` to Gitea fromt the Drone pipeline.
---
 .drone.yml | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/.drone.yml b/.drone.yml
index 663b3225..66197904 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -23,4 +23,36 @@ steps:
       - git fetch --tags
       - find . -type f -print0 | xargs -0 dos2unix
       - chmod +x /drone/src/*.sh
-      - /drone/src/compile.sh
\ No newline at end of file
+      - /drone/src/compile.sh
+
+  - name: upload-iso-artifact
+    image: curlimages/curl:latest
+    depends_on:
+      - compile
+    # when:
+    #   branch:
+    #     - master
+    environment:
+      GITEA_TOKEN:
+        from_secret: gitea_token
+    commands:
+      - export BUILD_VERSION=$(git rev-parse --short HEAD)
+      - export ISO_NAME="Asuro-${BUILD_VERSION}.iso"
+      - mv Asuro.iso "$ISO_NAME"
+      
+      # Upload commit-specific ISO
+      - |
+        echo "Uploading ${ISO_NAME} to Gitea Packages..."
+        curl -X POST "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${BUILD_VERSION}" \
+          -H "Authorization: token $GITEA_TOKEN" \
+          -F "file=@$ISO_NAME"
+
+      # Update the "latest" alias (delete old latest, re-upload)
+      - |
+        echo "Updating latest ISO reference..."
+        curl -X DELETE "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \
+          -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found."
+          
+        curl -X POST "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \
+          -H "Authorization: token $GITEA_TOKEN" \
+          -F "file=@$ISO_NAME"
\ No newline at end of file