From ebd21f98e2f01ead9cba926c910a11b0bb0ffc08 Mon Sep 17 00:00:00 2001 From: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:49:23 +0800 Subject: [PATCH] MAINT/DOC fix and refactor doc build workflow --- .github/workflows/doc-test.yaml | 51 ------------------- .../workflows/{doc-deploy.yaml => doc.yaml} | 10 +++- 2 files changed, 8 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/doc-test.yaml rename .github/workflows/{doc-deploy.yaml => doc.yaml} (86%) diff --git a/.github/workflows/doc-test.yaml b/.github/workflows/doc-test.yaml deleted file mode 100644 index fdb2663d..00000000 --- a/.github/workflows/doc-test.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Test doc build - -on: - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev - - - name: Rust setup - uses: dtolnay/rust-toolchain@stable - - - name: Rust cache - uses: swatinem/rust-cache@v2 - with: - workspaces: ./src-tauri -> target - - - name: Build Rust docs - run: | - cd src-tauri - cargo doc --no-deps - - - name: Node setup and cache - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: npm - - - name: Install doc dependencies - run: | - npm install - cd website - npm install - - - name: Build docs - run: | - cd website - npm run build diff --git a/.github/workflows/doc-deploy.yaml b/.github/workflows/doc.yaml similarity index 86% rename from .github/workflows/doc-deploy.yaml rename to .github/workflows/doc.yaml index c267ef77..27164762 100644 --- a/.github/workflows/doc-deploy.yaml +++ b/.github/workflows/doc.yaml @@ -1,9 +1,12 @@ -name: Deploy docs to GitHub Pages +name: Doc build and deploy on: push: branches: - main + pull_request: + branches: + - main jobs: build: @@ -51,7 +54,9 @@ jobs: npm run build - name: Copy Rust docs to build directory - run: cp -r src-tauri/target/doc website/build/rustdoc + run: | + rm -f src-tauri/target/doc/.lock + cp -r src-tauri/target/doc website/build/rustdoc - name: Upload build artifact uses: actions/upload-pages-artifact@v3 @@ -60,6 +65,7 @@ jobs: deploy: needs: build + if: github.event_name == 'push' # Do not deploy on PRs permissions: pages: write id-token: write