From efac72ed71e8663a2a8def8c761126b4e54d89f5 Mon Sep 17 00:00:00 2001 From: mario4tier Date: Tue, 10 Oct 2023 00:49:54 -0400 Subject: [PATCH] Website publish automation --- .github/actions/diffs/actions.yml | 34 ++++++++++++++++++++++ .github/workflows/docs.yml | 47 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/actions/diffs/actions.yml create mode 100644 .github/workflows/docs.yml diff --git a/.github/actions/diffs/actions.yml b/.github/actions/diffs/actions.yml new file mode 100644 index 00000000..54045e75 --- /dev/null +++ b/.github/actions/diffs/actions.yml @@ -0,0 +1,34 @@ +name: Detect Changes +description: Defines variables indicating the parts of the code that changed +outputs: + isDoc: + description: True when changes happened to some documentation + value: "${{ steps.diff.outputs.isDoc }}" + isRust: + description: True when changes happened to the Rust code + value: "${{ steps.diff.outputs.isRust }}" + isMove: + description: True when changes happened to the Move code + value: "${{ steps.diff.outputs.isMove }}" + +runs: + using: composite + steps: + - uses: actions/checkout@v3 + - name: Detect Changes + uses: dorny/paths-filter@v2.11.1 + id: diff + with: + filters: | + isRust: + - 'crates/**' + - '.github/workflows/rust.yml' + isDoc: + - 'docs/**' + - 'mkdocs.yml' + - '*.md' + - '.github/workflows/docs.yml' + isMove: + - 'move/sources/**' + - 'Cargo.toml' + - 'Cargo.lock' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..6d1a8b9a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,47 @@ +name: Documentation + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + +permissions: + contents: write + +jobs: + diff: + runs-on: [ubuntu-latest] + outputs: + isDoc: ${{ steps.diff.outputs.isDoc }} + steps: + - uses: actions/checkout@v3 + - name: Detect Changes + uses: "./.github/actions/diffs" + id: diff + + spelling: + name: Lint documentation + needs: diff + if: needs.diff.outputs.isDoc == 'true' + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - name: Spell Check Docs + uses: crate-ci/typos@master + with: + files: ./doc ./*.md + + deploy: + runs-on: ubuntu-latest + if: github.event.repository.fork == false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: pip install mkdocs-material + - run: pip install mkdocs-git-revision-date-localized-plugin + - run: pip install mkdocs-minify-plugin + - run: mkdocs gh-deploy --force