Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry arg #900

Open
louis030195 opened this issue Sep 4, 2024 · 2 comments
Open

retry arg #900

louis030195 opened this issue Sep 4, 2024 · 2 comments
Labels
type: feature request New feature or request

Comments

@louis030195
Copy link

keep having failed build that seem non deterministic

https://github.com/mediar-ai/screenpipe/actions/workflows/release-app.yml

usually:

  • runner running out of disk space (ubuntu)
  • some disk issue with mac x86_64
  • windows random issue

having a way to retry would save me probably at least 1h a week because i release 3 version a day on average

@FabianLars FabianLars added the type: feature request New feature or request label Sep 4, 2024
@louis030195
Copy link
Author

louis030195 commented Oct 22, 2024

failed to notarize on macos also, usually retry and it works

this feature would save me so much time

@louis030195
Copy link
Author

Here's a suggested change using the diff markdown syntax for adding a retry argument to the tauri-action:

diff --git a/src/index.ts b/src/index.ts
index 1234567..abcdef0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -24,6 +24,7 @@ async function run(): Promise<void> {
     const includeDebug = core.getBooleanInput('includeDebug');
     const includeUpdaterJson = core.getBooleanInput('includeUpdaterJson');
     const updaterJsonKeepUniversal = core.getBooleanInput('updaterJsonKeepUniversal');
+    const retryAttempts = parseInt(core.getInput('retryAttempts') || '1', 10);
     const tauriScript = core.getInput('tauriScript');
     const args = stringArgv(core.getInput('args'));
     const bundleIdentifier = core.getInput('bundleIdentifier');
@@ -76,14 +77,22 @@ async function run(): Promise<void> {
     const releaseArtifacts: Artifact[] = [];
     const debugArtifacts: Artifact[] = [];
     if (includeRelease) {
-      releaseArtifacts.push(
-        ...(await buildProject(projectPath, false, buildOptions, initOptions)),
-      );
+      for (let attempt = 1; attempt <= retryAttempts; attempt++) {
+        try {
+          releaseArtifacts.push(
+            ...(await buildProject(projectPath, false, buildOptions, initOptions)),
+          );
+          break;
+        } catch (error) {
+          if (attempt === retryAttempts) throw error;
+          console.log(`Build attempt ${attempt} failed, retrying...`);
+        }
+      }
     }
     if (includeDebug) {
-      debugArtifacts.push(
-        ...(await buildProject(projectPath, true, buildOptions, initOptions)),
-      );
+      // Similar retry logic for debug build
+      // ...
+    }
     const artifacts = releaseArtifacts.concat(debugArtifacts);

     if (artifacts.length === 0) {

This change introduces a new retryAttempts input parameter and implements a retry mechanism for the build process. It will attempt to build the project up to the specified number of times before giving up.

To use this new feature, you would add a new input to your GitHub Action workflow:

- uses: tauri-apps/tauri-action@v0
  with:
    # ... other inputs ...
    retryAttempts: 3

This would allow the build to retry up to 3 times if it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants