From a54e5335072665887b361074007830ab9b7df297 Mon Sep 17 00:00:00 2001 From: ryanycw Date: Wed, 30 Aug 2023 14:44:58 +0800 Subject: [PATCH 1/2] build: implement ci file for rust-doc to github pages --- .github/workflows/github-pages.yml | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000000..f1fa4ba7af --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,65 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Generate Docs + run: | + cargo doc --no-deps + echo "" > target/doc/index.html + - name: Archive artifact + shell: sh + run: | + chmod -c -R +rX "target/doc" | + while read line; do + echo "::warning title=Invalid file permissions automatically fixed::$line" + done + tar \ + --dereference --hard-dereference \ + --directory "target/doc" \ + -cvf "$RUNNER_TEMP/artifact.tar" \ + --exclude=.git \ + --exclude=.github \ + . + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: 'target/doc' + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From c1ce7585efba10759b78b28c3539ba1ae1b23ec9 Mon Sep 17 00:00:00 2001 From: ryanycw Date: Mon, 4 Sep 2023 16:13:07 +0800 Subject: [PATCH 2/2] docs(ci): add comments to rust-doc ci action --- .github/workflows/github-pages.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index f1fa4ba7af..437f303b99 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -30,10 +30,13 @@ jobs: - uses: actions-rs/toolchain@v1 - name: Setup Pages uses: actions/configure-pages@v3 + # Create a index.html outside of the subdirectories for requirement of GitHub pages - name: Generate Docs run: | cargo doc --no-deps echo "" > target/doc/index.html + # Archive the artifact with the correct permissions + # https://github.com/actions/deploy-pages/issues/188 - name: Archive artifact shell: sh run: |