From b88a5b44f3a704500999b14d72247e071fffdb76 Mon Sep 17 00:00:00 2001
From: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
Date: Mon, 10 Jun 2024 12:02:34 -0700
Subject: [PATCH] Implement cache v2

---
 dist/restore-only/index.js | 12 ++++++------
 dist/restore/index.js      | 12 ++++++------
 dist/save-only/index.js    | 12 ++++++------
 dist/save/index.js         | 12 ++++++------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index 3ee415e..3537aa3 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -10013,6 +10013,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            // Cache v2 upload
+            // inputs:
+            // - getSignedUploadURL
+            // - archivePath
+            core.debug(`Saving Cache v2: ${archivePath}`);
+            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
             core.debug('Reserving Cache');
             const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
                 compressionMethod,
@@ -10030,12 +10036,6 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
-            // Cache v2 upload
-            // inputs:
-            // - getSignedUploadURL
-            // - archivePath
-            core.debug(`Saving Cache v2: ${archivePath}`);
-            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
         }
         catch (error) {
             const typedError = error;
diff --git a/dist/restore/index.js b/dist/restore/index.js
index 39cc97c..b75e79c 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -10013,6 +10013,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            // Cache v2 upload
+            // inputs:
+            // - getSignedUploadURL
+            // - archivePath
+            core.debug(`Saving Cache v2: ${archivePath}`);
+            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
             core.debug('Reserving Cache');
             const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
                 compressionMethod,
@@ -10030,12 +10036,6 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
-            // Cache v2 upload
-            // inputs:
-            // - getSignedUploadURL
-            // - archivePath
-            core.debug(`Saving Cache v2: ${archivePath}`);
-            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
         }
         catch (error) {
             const typedError = error;
diff --git a/dist/save-only/index.js b/dist/save-only/index.js
index 46b10de..fc35fdb 100644
--- a/dist/save-only/index.js
+++ b/dist/save-only/index.js
@@ -10013,6 +10013,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            // Cache v2 upload
+            // inputs:
+            // - getSignedUploadURL
+            // - archivePath
+            core.info(`Saving Cache v2: ${archivePath}`);
+            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
             core.debug('Reserving Cache');
             const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
                 compressionMethod,
@@ -10030,12 +10036,6 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
-            // Cache v2 upload
-            // inputs:
-            // - getSignedUploadURL
-            // - archivePath
-            core.debug(`Saving Cache v2: ${archivePath}`);
-            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
         }
         catch (error) {
             const typedError = error;
diff --git a/dist/save/index.js b/dist/save/index.js
index 716128d..d8db196 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -10013,6 +10013,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            // Cache v2 upload
+            // inputs:
+            // - getSignedUploadURL
+            // - archivePath
+            core.debug(`Saving Cache v2: ${archivePath}`);
+            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
             core.debug('Reserving Cache');
             const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
                 compressionMethod,
@@ -10030,12 +10036,6 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
             }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
-            // Cache v2 upload
-            // inputs:
-            // - getSignedUploadURL
-            // - archivePath
-            core.debug(`Saving Cache v2: ${archivePath}`);
-            yield (0, upload_cache_1.UploadCache)(signedUploadURL, archivePath);
         }
         catch (error) {
             const typedError = error;