2022-01-18 22:08:27 +05:30
|
|
|
name: Build and deploy docs
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
2022-06-17 22:09:12 +05:30
|
|
|
- "*.*.*"
|
2022-01-18 23:07:14 +05:30
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
workflow_dispatch:
|
2022-01-18 22:08:27 +05:30
|
|
|
|
2022-09-12 07:56:08 -07:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-01-18 22:08:27 +05:30
|
|
|
jobs:
|
|
|
|
build:
|
2022-05-23 19:49:14 +05:30
|
|
|
if: github.repository_owner == 'xonsh'
|
2022-01-18 22:08:27 +05:30
|
|
|
runs-on: ubuntu-latest
|
2024-04-22 12:21:18 +05:30
|
|
|
env:
|
|
|
|
UV_CACHE_DIR: .cache/uv
|
2022-01-18 22:08:27 +05:30
|
|
|
name: Xonsh docs to gh-pages
|
|
|
|
steps:
|
2023-09-18 10:44:38 +05:30
|
|
|
- uses: actions/checkout@v4
|
2022-01-18 22:08:27 +05:30
|
|
|
- name: Setup Python
|
2023-12-11 10:58:51 +01:00
|
|
|
uses: actions/setup-python@v5
|
2022-01-18 22:08:27 +05:30
|
|
|
with:
|
2022-06-17 22:09:12 +05:30
|
|
|
python-version: "3.10"
|
2024-04-22 12:01:05 +05:30
|
|
|
- uses: yezz123/setup-uv@v4
|
|
|
|
- name: set current week
|
2024-04-22 12:28:06 +05:30
|
|
|
run: echo WEEK=$(date +%V) >>$GITHUB_ENV
|
|
|
|
shell: bash
|
2024-04-22 12:01:05 +05:30
|
|
|
- name: Cache uv pip for a week
|
|
|
|
id: cache-uv
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: ${{ env.UV_CACHE_DIR }}
|
2024-04-22 12:28:06 +05:30
|
|
|
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}-${{ env.WEEK }}
|
2024-04-22 12:01:05 +05:30
|
|
|
restore-keys: ${{ runner.os }}-uv-
|
|
|
|
- run: uv pip install --system -e '.[doc]'
|
2022-01-18 22:08:27 +05:30
|
|
|
- name: Build Docs
|
|
|
|
run: cd docs && make html
|
2023-09-18 10:48:19 +05:30
|
|
|
- uses: tibdex/github-app-token@v2
|
2022-01-25 21:22:47 -05:00
|
|
|
if: ${{ github.event_name != 'pull_request' }}
|
2022-01-18 22:08:27 +05:30
|
|
|
id: generate-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
2022-03-15 10:33:44 -04:00
|
|
|
repository: xonsh/xonsh-docs
|
2022-01-18 22:08:27 +05:30
|
|
|
- name: Deploy to dev if not tagged
|
2022-01-18 23:07:14 +05:30
|
|
|
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/v')
|
2024-04-15 11:21:34 +02:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2022-01-18 22:08:27 +05:30
|
|
|
with:
|
2022-03-15 10:39:19 -04:00
|
|
|
personal_token: ${{ steps.generate-token.outputs.token }}
|
2022-01-18 22:08:27 +05:30
|
|
|
external_repository: xonsh/xonsh-docs
|
|
|
|
publish_dir: ./docs/_build/html
|
|
|
|
destination_dir: dev # latest as in main branch
|
|
|
|
- name: Deploy to stable if tagged
|
2022-01-18 23:07:14 +05:30
|
|
|
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
|
2024-04-15 11:21:34 +02:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2022-01-18 22:08:27 +05:30
|
|
|
with:
|
2022-03-15 10:39:19 -04:00
|
|
|
personal_token: ${{ steps.generate-token.outputs.token }}
|
2022-01-18 22:08:27 +05:30
|
|
|
external_repository: xonsh/xonsh-docs
|
|
|
|
publish_dir: ./docs/_build/html
|
|
|
|
# # todo: implement versioned docs
|
|
|
|
|