Explorar el Código

Fix: docs (#1950)

* fix: Invalid YML

* fix: Workaroung for  +

* fix: Forgot double quotes

* fix: Adapting to definition limits

* fix: Resetting v1 for rustdocusaurus

* fix: Installing API deps

* fix: Installing API deps

* fix: Typedoc fails with TS > 4.2

* fix: Running on core-docs-sidebar branch for tauri-docs

* fix: Attempt with WORKSPAC env variable

Signed-off-by: Laegel <valentin.chouaf@laposte.net>

* fix: Var not evaluated

* fix: Alternate workspace variable

* fix: Applying workspace var to other steps

* fix: Using workspace variable

* fix: Copy folder content instead

* fix: typedocusaurus targetPath and added input version

* fix: Attempt to make create-dotenv work

* fix: Attempt to make create-dotenv work

* fix: Attempt to make create-dotenv work

* fix: Attempt to make search bot scp & start work

* fix: Added on release trigger
Laegel hace 4 años
padre
commit
96387591dd
Se han modificado 1 ficheros con 28 adiciones y 18 borrados
  1. 28 18
      .github/workflows/update-docs.yml

+ 28 - 18
.github/workflows/update-docs.yml

@@ -5,6 +5,8 @@
 name: update-docs
 
 on:
+  release:
+    types: [published]
   workflow_dispatch:
     inputs:
       gitName:
@@ -15,6 +17,9 @@ on:
         description: "git email for PR"
         required: false
         default: "tauri-bot@tauri.studio"
+      version:
+        description: "Tauri version"
+        required: true
 
 jobs:
   update-docs:
@@ -30,6 +35,7 @@ jobs:
         with:
           repository: tauri-apps/tauri-docs
           path: tauri-docs
+          ref: feat/core-docs-sidebar
       - name: checkout tauri-search-bot
         uses: actions/checkout@v2
         with:
@@ -45,63 +51,67 @@ jobs:
         working-directory: ./tauri/core/tauri
         run: cargo doc --no-deps
       - name: run rustdocusaurus
-        uses: tauri-apps/rustdocusaurus/github-action@v1.0.3
+        uses: tauri-apps/rustdocusaurus/github-action@v1
         with:
           originPath: ./tauri/target/doc/
           targetPath: ./tauri-docs/docs/en/api/rust/
-          sidebarPath: ./tauri-docs/sidebars/rustdoc.json
+          sidebarPath: "${{ github.workspace }}/tauri-docs/sidebars/rustdoc.json"
           linksRoot: ""
           cratesToProcess: "tauri"
 
       # TypeScript
+      - name: install API deps
+        working-directory: ./tauri/tooling/api
+        run: yarn && yarn add typescript@4.2
       - name: run typedocusaurus
         uses: tauri-apps/typedocusaurus@v1
         with:
           originPath: ./tauri/tooling/api/
-          sidebarFile: ./tauri-docs/sidebars/typedoc.json
-          targetPath: ./tauri-docs/en/api/js/
+          sidebarFile: "${{ github.workspace }}/tauri-docs/sidebars/typedoc.json"
+          targetPath: ./tauri-docs/en/api/js
           docusaurusPath: ./tauri-docs/
 
       # Moving docs for Indexation
       - name: copy docs
         working-directory: ./tauri
-        run: mv docs/sidebar.json ../tauri-docs/sidebars/core.json && cp -r docs ../tauri-docs/docs/en
+        run: mv docs/sidebar.json ${{ github.workspace }}/tauri-docs/sidebars/core.json && cp -r docs/* ${{ github.workspace }}/tauri-docs/docs/en
 
       # Indexing
       - name: meilisearch indexation
         uses: tauri-apps/docusaurus-meilisearch-indexer@v1
         with:
-          - version: ${{ github.event.release.tag_name }}
-          - docusaurusPath: ./tauri-docs
-          - host: https://search.tauri.studio
-          - apiKey: ${{ secrets.MEILISEARCH_APIKEY }}
-          - docs: "Getting started,Usage,API"
+          version: ${{ github.event.inputs.version || github.event.release.tag_name }}
+          docusaurusPath: "${{ github.workspace }}/tauri-docs"
+          host: https://search.tauri.studio
+          apiKey: ${{ secrets.MEILISEARCH_APIKEY }}
+          docs: "Getting started,Usage,API"
 
       # Applying Version
       - name: set docs' Tauri version
         working-directory: ./tauri-docs
-        run: echo ${{ github.event.release.tag_name }} > version.txt
+        run: echo ${{ github.event.inputs.version || github.event.release.tag_name }} > version.txt
       - name: set bot's Tauri version
-        working-directory: ./tauri-search-bot
         uses: iamsauravsharma/create-dotenv@v1.1.0
+        with:
+          env-prefix: "ENV_KEY_"
+          directory: "${{ github.workspace }}/tauri-search-bot"
         env:
           ENV_KEY_DISCORD_BOT_SECRET: ${{ secrets.DISCORD_BOT_SECRET }}
-          ENV_KEY_PREFIX: !
+          ENV_KEY_PREFIX: "!"
           ENV_KEY_SITE: tauri.studio
           ENV_KEY_ICON: https://i.imgur.com/UzDERvw.png
-          ENV_KEY_LIMIT: 5
-          ENV_KEY_SEARCH_INDEX: ${{ github.event.release.tag_name }}
+          ENV_KEY_LIMIT: 8
+          ENV_KEY_SEARCH_INDEX: ${{ github.event.inputs.version || github.event.release.tag_name }}
           ENV_KEY_MEILISEARCH_PUBLIC_KEY: ea0105f56bb5a2111ed28c7a0c637fc0bed07273f571dc7cb1f73900e44f8e7f
 
       # Bot Deployment
       - name: scp bot
-        working-directory: ./tauri-search-bot
         uses: appleboy/scp-action@master
         with:
           host: ${{ secrets.DISCORD_BOT_HOST }}
           username: ${{ secrets.DISCORD_BOT_SSH_USER }}
           key: ${{ secrets.DISCORD_BOT_SSH_KEY }}
-          source: "."
+          source: "${{ github.workspace }}/tauri-search-bot"
           target: "~/tauri-search-bot"
       - name: restart the bot
         uses: appleboy/ssh-action@master
@@ -109,7 +119,7 @@ jobs:
           host: ${{ secrets.DISCORD_BOT_HOST }}
           username: ${{ secrets.DISCORD_BOT_SSH_USER }}
           key: ${{ secrets.DISCORD_BOT_SSH_KEY }}
-          script: cd ~/tauri-search-bot && yarn && forever stopall && forever start ./src/index.js
+          script: cd ~/tauri-search-bot/github/workspace/tauri-search-bot && yarn && forever stopall && forever start ./src/index.js
 
       # tauri-docs PR
       - name: git config