diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000..e4ac57b6 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,82 @@ +name: GitHub Pages + +on: + workflow_dispatch: + push: + branches: + - master + paths: + - docs/** + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + dispatch: + + runs-on: ubuntu-latest + + steps: + - name: Dispatch to gdl-org/docs + run: > + curl -L + -X POST + -H "Accept: application/vnd.github+json" + -H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}" + -H "X-GitHub-Api-Version: 2022-11-28" + https://api.github.com/repos/gdl-org/docs/actions/workflows/pages.yml/dispatches + -d '{"ref":"master"}' + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/configure-pages@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install Docutils + run: pip install docutils pygments + + - name: Update Links + working-directory: ./docs/ + run: sed --in-place 's/\.\(rst\|md\)\b/.html/g' -- *.md *.rst + + - name: reStructuredText to HTML + working-directory: ./docs/ + run: | + while read -r RST + do + python -m docutils --writer=html --output="${RST%.rst}.html" -- "$RST" + done < <(find . -type f -name "*.rst") + + - uses: actions/jekyll-build-pages@v1 + with: + source: ./docs/ + destination: ./_site/ + + - uses: actions/upload-pages-artifact@v3 + + deploy: + + runs-on: ubuntu-latest + + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - uses: actions/deploy-pages@v4 + id: deployment diff --git a/.github/workflows/pages_dispatch.yml b/.github/workflows/pages_dispatch.yml deleted file mode 100644 index 835c1400..00000000 --- a/.github/workflows/pages_dispatch.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Dispatch GitHub Pages Build - -on: - workflow_dispatch: - push: - branches: - - "master" - paths: - - "docs/**" - -jobs: - dispatch: - runs-on: ubuntu-latest - steps: - - name: dispatch - run: > - curl -L - -X POST - -H "Accept: application/vnd.github+json" - -H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}" - -H "X-GitHub-Api-Version: 2022-11-28" - https://api.github.com/repos/gdl-org/docs/actions/workflows/pages.yml/dispatches - -d '{"ref":"master"}'