ci: deploy the API document to GitHub Pages of this repo instead of r… #2789
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow is a mix of: | |
# - https://github.com/pola-rs/r-polars/blob/main/.github/workflows/check.yaml | |
# - https://github.com/r-lib/actions/blob/v2-branch/examples/pkgdown.yaml | |
# - https://squidfunk.github.io/mkdocs-material/publishing-your-site/?h=deploy#material-for-mkdocs | |
name: docs | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
paths: | |
- .github/workflows/docs.yaml | |
- altdoc/** | |
- man/** | |
- R/** | |
- src/** | |
- vignettes/** | |
- DESCRIPTION | |
- README.md | |
- NEWS.md | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/actions/setup/action.yaml | |
- .github/workflows/docs.yaml | |
- altdoc/** | |
- man/** | |
- R/** | |
- src/** | |
- vignettes/** | |
- DESCRIPTION | |
- README.md | |
- NEWS.md | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
LIBR_POLARS_FEATURES: "full_features" | |
LIBR_POLARS_BUILD: "true" | |
LIBR_POLARS_PROFILE: release | |
permissions: read-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
docs_key: ${{ secrets.DEPLOY_DOCS }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set rust target | |
id: rust-target | |
run: | | |
if [ "${{ runner.os }}" == "Windows" ]; then | |
echo "TARGET=x86_64-pc-windows-gnu" >>"$GITHUB_OUTPUT" | |
else | |
echo "TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>"$GITHUB_OUTPUT" | |
fi | |
- uses: ./.github/actions/setup | |
with: | |
target: "${{ steps.rust-target.outputs.TARGET }}" | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
Ncpus: 2 | |
# altdoc uses quarto | |
- uses: quarto-dev/quarto-actions/setup@v2 | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::rcmdcheck | |
needs: dev,website | |
- name: Get requirements | |
run: | | |
task setup-python-tools | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Build docs | |
run: task build-website | |
- name: upload docs | |
if: always() | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs | |
deploy: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ (github.event_name != 'pull_request') }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: ${{ (github.event_name != 'pull_request') }} | |
uses: actions/deploy-pages@v4 |