From a2cce4209bf5d73466752a80dd1e5800655dbf7b Mon Sep 17 00:00:00 2001
From: Martin Bubel <martin.bubel@itwm.fraunhofer.de>
Date: Mon, 22 Jul 2024 11:22:23 +0200
Subject: [PATCH] inspect deploy job before doing the release

---
 .github/workflows/test-and-deploy.yml | 43 +++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml
index 093984b82..30316c12c 100644
--- a/.github/workflows/test-and-deploy.yml
+++ b/.github/workflows/test-and-deploy.yml
@@ -110,7 +110,7 @@ jobs:
           pytest GPy/testing
 
   build-windows:
-    if: github.event_name == 'release'
+    # if: github.event_name == 'release'
     strategy:
       matrix:
         os: [windows-latest]
@@ -143,7 +143,7 @@ jobs:
           path: dist
 
   build-macos:
-    if: github.event_name == 'release'
+    # if: github.event_name == 'release'
     strategy:
       matrix:
         os: [macos-latest]
@@ -243,6 +243,45 @@ jobs:
       #     name: dist-artifacts-manylinux-${{ matrix.python }}
       #     path: dist/*
 
+  deploy-test:
+    runs-on: ubuntu-latest
+    needs: [test-windows, test-linux, test-macos, build-linux, build-windows, build-macos]
+    # if: github.event_name == 'release'
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Setup python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.9'
+
+      - name: Install twine
+        run: |
+          pip install --upgrade pip
+          pip install twine
+    
+      - name: Download all artifacts to a specific directory
+        uses: actions/download-artifact@v3
+        with:
+          path: dist
+
+      - name: Create dist directory
+        run: mkdir -p dist
+
+      - name: Move files from subdirectories
+        run: |
+          for subdirectory in dist/*/; do
+            dir_name=$(basename "$subdirectory")
+            mv "$subdirectory"* dist/
+            rm -r "$subdirectory"
+            echo "Moved files from '$dir_name' to 'dist/'"
+          done
+
+      - name: Inspect wheel files
+        run: |
+          ls -R dist
+
   deploy:
     runs-on: ubuntu-latest
     needs: [test-windows, test-linux, test-macos, build-linux, build-windows, build-macos]