Browse Source

Fix Github Actions of Tauri Plugin with-api template (#6603)

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Miniontoby 2 years ago
parent
commit
a926b49a01

+ 7 - 0
.changes/cli-templates.md

@@ -0,0 +1,7 @@
+---
+"cli.rs": "patch"
+"cli.js": "patch"
+---
+
+Fix Outdated Github Actions in the Plugin Templates `with-api` and `backend`
+

+ 4 - 1
tooling/cli/templates/plugin/backend/.github/workflows/audit.yml

@@ -21,8 +21,11 @@ jobs:
   audit:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - uses: actions-rs/audit-check@v1
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
+    permissions:
+      issues: write
+      checks: write
 {{{{/raw}}}}

+ 1 - 1
tooling/cli/templates/plugin/backend/.github/workflows/covector-status.yml

@@ -7,7 +7,7 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
         with:
           fetch-depth: 0
       - name: covector status

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

@@ -10,7 +10,7 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
         with:
           fetch-depth: 0
 

+ 1 - 1
tooling/cli/templates/plugin/backend/.github/workflows/format.yml

@@ -17,7 +17,7 @@ jobs:
       fail-fast: false
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
     - name: Install rustfmt with stable toolchain
       uses: actions-rs/toolchain@v1
       with:

+ 1 - 1
tooling/cli/templates/plugin/backend/.github/workflows/lint.yml

@@ -17,7 +17,7 @@ jobs:
       fail-fast: false
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - name: install webkit2gtk
         run: |
           sudo apt-get update

+ 1 - 1
tooling/cli/templates/plugin/backend/.github/workflows/test.yml

@@ -23,7 +23,7 @@ jobs:
         os: [ubuntu-latest, macos-latest, windows-latest]
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Install stable toolchain
       uses: actions-rs/toolchain@v1

+ 5 - 2
tooling/cli/templates/plugin/with-api/.github/workflows/audit.yml

@@ -21,8 +21,11 @@ jobs:
   audit:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions-rs/audit-check@v1
+      - uses: actions/checkout@v3
+      - uses: rustsec/audit-check@v1
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
+    permissions:
+      issues: write
+      checks: write
 {{{{/raw}}}}

+ 10 - 12
tooling/cli/templates/plugin/with-api/.github/workflows/clippy.yml

@@ -17,21 +17,19 @@ jobs:
       fail-fast: false
 
     steps:
-      - uses: actions/checkout@v2
-      - name: install webkit2gtk
+      - uses: actions/checkout@v3
+
+      - name: Install dependencies
         run: |
           sudo apt-get update
           sudo apt-get install -y webkit2gtk-4.0
+
       - name: Install clippy with stable toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-            profile: minimal
-            toolchain: stable
-            override: true
-            components: clippy
-      - uses: actions-rs/clippy-check@v1
+        uses: dtolnay/rust-toolchain@stable
         with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          args: --manifest-path=Cargo.toml --all-targets --all-features -- -D warnings
-          name: clippy
+          components: clippy
+
+      - uses: Swatinem/rust-cache@v2
+
+      - run: cargo clippy --manifest-path=Cargo.toml --all-targets --all-features -- -D warnings
 {{{{/raw}}}}

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

@@ -10,7 +10,7 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
         with:
           fetch-depth: 0
       - uses: actions/setup-node@v2

+ 9 - 11
tooling/cli/templates/plugin/with-api/.github/workflows/format.yml

@@ -17,16 +17,14 @@ jobs:
       fail-fast: false
 
     steps:
-    - uses: actions/checkout@v2
-    - name: Install rustfmt with stable toolchain
-      uses: actions-rs/toolchain@v1
-      with:
-          profile: minimal
-          toolchain: stable
-          override: true
+      - uses: actions/checkout@v3
+
+      - name: Install rustfmt with stable toolchain
+        uses: dtolnay/rust-toolchain@stable
+        with:
           components: rustfmt
-    - uses: actions-rs/cargo@v1
-      with:
-        command: fmt
-        args: --manifest-path=Cargo.toml --all -- --check
+
+      - uses: Swatinem/rust-cache@v2
+
+      - run: cargo fmt --manifest-path=Cargo.toml --all -- --check
 {{{{/raw}}}}

+ 13 - 16
tooling/cli/templates/plugin/with-api/.github/workflows/test.yml

@@ -23,24 +23,21 @@ jobs:
         os: [ubuntu-latest, macos-latest, windows-latest]
 
     steps:
-    - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
-    - name: Install stable toolchain
-      uses: actions-rs/toolchain@v1
-      with:
-        toolchain: stable
-        override: true
+      - name: Install stable toolchain
+        uses: dtolnay/rust-toolchain@stable
+        with:
+          components: clippy
 
-    - name: Install Linux dependencies
-      run: |
-        sudo apt-get update
-        sudo apt-get install -y webkit2gtk-4.0
+      - name: Install Linux dependencies
+        if: matrix.os == 'ubuntu-latest'
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y webkit2gtk-4.0
 
-    - uses: Swatinem/rust-cache@v2
+      - uses: Swatinem/rust-cache@v2
 
-    - name: Run tests
-      uses: actions-rs/cargo@v1
-      with:
-        command: test
-        args: --manifest-path=Cargo.toml --release
+      - name: Run tests
+        run: cargo test --manifest-path=Cargo.toml --release
 {{{{/raw}}}}