Bläddra i källkod

fix(cli): add prepublish scripts to the plugin templates

Lucas Nogueira 3 år sedan
förälder
incheckning
b8a64d01ba

+ 6 - 0
.changes/cli-plugin-template-covector.md

@@ -0,0 +1,6 @@
+---
+"cli.rs": patch
+"cli.js": patch
+---
+
+Fixes the covector configuration on the plugin templates.

+ 30 - 0
tooling/cli/templates/plugin/backend/.changes/config.json

@@ -4,6 +4,36 @@
     "rust": {
       "version": true,
       "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
+      "prepublish": [
+        "sudo apt-get update",
+        "sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0",
+        "cargo install cargo-audit",
+        {
+          "command": "cargo generate-lockfile",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo \"# Cargo Audit\"",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo '```'",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo '```'",
+          "dryRunCommand": true,
+          "pipe": true
+        }
+      ],
       "publish": [
         {
           "command": "cargo package --allow-dirty",

+ 6 - 0
tooling/cli/templates/plugin/backend/.github/workflows/covector-version-or-publish.yml

@@ -17,10 +17,15 @@ jobs:
         with:
           node-version: 12
           registry-url: 'https://registry.npmjs.org'
+
+      - name: cargo login
+        run: cargo login ${{ secrets.CRATE_TOKEN }}
+
       - name: git config
         run: |
           git config --global user.name "${{ github.event.pusher.name }}"
           git config --global user.email "${{ github.event.pusher.email }}"
+
       - name: covector version-or-publish
         uses: jbolda/covector/packages/action@covector-v0
         id: covector
@@ -28,6 +33,7 @@ jobs:
           token: ${{ secrets.GITHUB_TOKEN }}
           command: 'version-or-publish'
           createRelease: true
+
       - name: Create Pull Request With Versions Bumped
         if: steps.covector.outputs.commandRan == 'version'
         uses: tauri-apps/create-pull-request@v3.4.1

+ 33 - 1
tooling/cli/templates/plugin/with-api/.changes/config.json

@@ -4,6 +4,36 @@
     "rust": {
       "version": true,
       "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
+      "prepublish": [
+        "sudo apt-get update",
+        "sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0",
+        "cargo install cargo-audit",
+        {
+          "command": "cargo generate-lockfile",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo \"# Cargo Audit\"",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo '```'",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }",
+          "dryRunCommand": true,
+          "pipe": true
+        },
+        {
+          "command": "echo '```'",
+          "dryRunCommand": true,
+          "pipe": true
+        }
+      ],
       "publish": [
         {
           "command": "cargo package --allow-dirty",
@@ -66,7 +96,9 @@
     "tauri-plugin-{{ plugin_name }}-api": {
       "path": ".",
       "manager": "javascript",
-      "dependencies": ["tauri-plugin-{{ plugin_name }}"]
+      "dependencies": [
+        "tauri-plugin-{{ plugin_name }}"
+      ]
     }
   }
 }

+ 6 - 0
tooling/cli/templates/plugin/with-api/.github/workflows/covector-version-or-publish.yml

@@ -17,10 +17,15 @@ jobs:
         with:
           node-version: 12
           registry-url: 'https://registry.npmjs.org'
+
+      - name: cargo login
+        run: cargo login ${{ secrets.CRATE_TOKEN }}
+
       - name: git config
         run: |
           git config --global user.name "${{ github.event.pusher.name }}"
           git config --global user.email "${{ github.event.pusher.email }}"
+
       - name: covector version-or-publish
         uses: jbolda/covector/packages/action@covector-v0
         id: covector
@@ -28,6 +33,7 @@ jobs:
           token: ${{ secrets.GITHUB_TOKEN }}
           command: 'version-or-publish'
           createRelease: true
+
       - name: Create Pull Request With Versions Bumped
         if: steps.covector.outputs.commandRan == 'version'
         uses: tauri-apps/create-pull-request@v3.4.1