From 4dfbefff807026fbdc08bbafdb23ed8ff66a0a18 Mon Sep 17 00:00:00 2001
From: Giuseppe Carboni <giuseppecarboni89@live.com>
Date: Wed, 2 Apr 2025 14:13:48 +0200
Subject: [PATCH] Added download of VM for master branch (#917)

---
 .github/workflows/download-vm.yml | 42 +++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 .github/workflows/download-vm.yml

diff --git a/.github/workflows/download-vm.yml b/.github/workflows/download-vm.yml
new file mode 100644
index 000000000..4857670f1
--- /dev/null
+++ b/.github/workflows/download-vm.yml
@@ -0,0 +1,42 @@
+name: Download the DISCOS VM
+
+on:
+  workflow_dispatch:
+  repository_dispatch:
+    types: [update-vm]
+
+concurrency:
+  group: discos
+  cancel-in-progress: false
+
+jobs:
+  download-vm:
+    runs-on: ubuntu-latest
+    env:
+      REPOSITORY_TOKEN: "${{ secrets.DEPENDENCIES_TOKEN }}"
+      GH_TOKEN: "${{ secrets.GH_WORKFLOWS_TOKEN }}"
+      GOOGLE_DRIVE_TOKEN: "${{ secrets.GOOGLE_DRIVE_TOKEN }}"
+      PROVISIONED_VM_GDRIVE_ID: "${{ secrets.PROVISIONED_VM_GDRIVE_ID }}"
+      PROVISIONED_ARCHIVE_GDRIVE_ID: "${{ secrets.PROVISIONED_ARCHIVE_GDRIVE_ID }}"
+    steps:
+      - name: Clone the deployment repository
+        uses: actions/checkout@v4
+        with:
+          repository: 'discos/deployment'
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3'
+          check-latest: true
+      - name: Download the provisioned virtual machine from Google Drive
+        run: |
+          pip install -r .github/utils/gdrive_requirements.txt
+          python .github/utils/download_from_gdrive.py
+          gh secret set GOOGLE_DRIVE_TOKEN --org discos --visibility selected --repos discos,deployment < token.json
+      - name: Save the downloaded VM to cache
+        uses: actions/cache/save@v4
+        with:
+          key: discos-manager-vm
+          path: |
+            /home/runner/discos_manager.ova
+            /home/runner/vagrant.tar.gz
-- 
GitLab