Prechádzať zdrojové kódy

chore: push updates.json to a separate branch

Gerald 4 rokov pred
rodič
commit
1dd2a5a827
2 zmenil súbory, kde vykonal 16 pridanie a 6 odobranie
  1. 9 2
      .github/workflows/release.yml
  2. 7 4
      scripts/amo-sign.js

+ 9 - 2
.github/workflows/release.yml

@@ -27,14 +27,21 @@ jobs:
           TARGET=selfHosted BETA=1 npx gulp manifest
           cd dist && zip -r ../$TEMP_DIR/$ASSET_SELF_HOSTED_ZIP . && cd ..
       - name: Sign AMO
+        id: signAMO
         continue-on-error: true
         run: |
+          mkdir -p $TEMP_DIR/updates
           node scripts/amo-sign
-          hub release edit beta -p -m '' -a $TEMP_DIR/updates.json
         env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           AMO_KEY: ${{ secrets.AMO_KEY }}
           AMO_SECRET: ${{ secrets.AMO_SECRET }}
+      - name: Update updates.json
+        uses: JamesIves/github-pages-deploy-action@releases/v3
+        if: steps.signAMO.outcome == 'success'
+        with:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          BRANCH: updates
+          FOLDER: ${{ env.TEMP_DIR }}/updates
       - name: Create Release
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 7 - 4
scripts/amo-sign.js

@@ -20,13 +20,16 @@ async function main() {
   });
   if (!result.success) {
     console.error(result);
-    process.exitCode = 1;
-    return;
+    if (!result.errorDetails?.startsWith('Version already exists.')) {
+      process.exitCode = 1;
+      return;
+    }
   }
-  const fileName = path.basename(result.downloadedFiles[0]);
+  // const fileName = path.basename(result.downloadedFiles[0]);
+  const fileName = `violentmonkey-${version}-an+fx.xpi`;
   const url = `https://github.com/violentmonkey/violentmonkey/releases/download/v${rawVersion}/${fileName}`;
   const updates = await buildUpdatesList(version, url);
-  await fs.writeFile(path.join(process.env.TEMP_DIR, 'updates.json'), JSON.stringify(updates, null, 2), 'utf8');
+  await fs.writeFile(path.join(process.env.TEMP_DIR, 'updates/updates.json'), JSON.stringify(updates, null, 2), 'utf8');
 }
 
 main();