diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 7dd58c68f1..1cc5438ce6 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -12,5 +12,20 @@ webapp: &webapp - 'webapp/**/*' - 'package.json' -markdown-files: &markdown-files +docs-check: &docs-check + - '.github/workflows/check-documentation.yml' + +markdown: &markdown + - *docs-check - '**/*.md' + - '.github/workflows/mlc_config.json' + +vuepress: &vuepress + - *docs-check + - '.github/workflows/deploy-documentation.yml' + - '.vuepress/**/*' + - 'package.json' + +documentation: &documentation + - *vuepress + - *markdown diff --git a/.github/workflows/check-documentation.yml b/.github/workflows/check-documentation.yml index 78e9736523..49b3e1ac13 100644 --- a/.github/workflows/check-documentation.yml +++ b/.github/workflows/check-documentation.yml @@ -7,7 +7,8 @@ jobs: name: Detect File Changes - Markdown files runs-on: ubuntu-latest outputs: - markdown-files: ${{ steps.changes.outputs.markdown-files }} + markdown: ${{ steps.changes.outputs.markdown }} + documentation: ${{ steps.changes.outputs.documentation }} steps: - name: Checkout code uses: actions/checkout@master @@ -22,21 +23,43 @@ jobs: check-markdown-links: name: Check Markdown links - if: needs.files-changed.outputs.markdown-files == 'true' needs: files-changed runs-on: ubuntu-latest + if: needs.files-changed.outputs.markdown == 'true' steps: - - name: Checkout code - uses: actions/checkout@master - - name: Remove old documentation files - run: rm -rf ./deployment/src/old/ ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done - - name: Check Markdown Links - uses: gaurav-nelson/github-action-markdown-link-check@master - with: - use-quiet-mode: 'yes' - use-verbose-mode: 'no' - # at any .md file change take the chance to check the links in all .md files - check-modified-files-only: 'no' - config-file: '.github/workflows/mlc_config.json' - base-branch: 'master' - folder-path: '.' + - name: Checkout code + uses: actions/checkout@master + + - name: Remove old documentation files + run: rm -rf ./deployment/src/old/ ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done + + - name: Check Markdown Links + uses: gaurav-nelson/github-action-markdown-link-check@master + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'no' + # at any .md file change take the chance to check the links in all .md files + check-modified-files-only: 'no' + config-file: '.github/workflows/mlc_config.json' + base-branch: 'master' + folder-path: '.' + + test-vuepress-build: + name: Test Vuepress build + needs: files-changed + runs-on: ubuntu-latest + if: needs.files-changed.outputs.documentation == 'true' + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Setup Node 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: npm-install + run: npm install + + - name: npm-docs:build + run: npm run docs:build diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml new file mode 100644 index 0000000000..9a2716a5d8 --- /dev/null +++ b/.github/workflows/deploy-documentation.yml @@ -0,0 +1,48 @@ +name: ocelot.social deploy documentation + +on: + push: + branches: + - master + +jobs: + files-changed: + name: Detect File Changes - Markdown and Vuepress files + runs-on: ubuntu-latest + outputs: + documentation: ${{ steps.changes.outputs.documentation }} + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Check for file changes + uses: dorny/paths-filter@master + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup Node 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build Vuepress Pages + run: npm install && npm run build + + - name: Deploy Vuepress to Github Pages + uses: crazy-max/ghaction-github-pages@v4 + with: + target_branch: gh-pages + build_dir: .vuepress/dist + author: Wolfgang Huß + fqdn: docs.ocelot.social + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}