| 1 |
name: Deploy PR previews on GH pages |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
|
| 11 |
concurrency: preview-${{ github.ref }} |
| 12 |
env: |
| 13 |
FORCE_COLOR: "1" |
| 14 |
PYTHONIOENCODING: utf-8 |
| 15 |
SETUPTOOLS_SCM_PRETEND_VERSION: "1.0" # avoid warnings about shallow checkout |
| 16 |
|
| 17 |
jobs: |
| 18 |
deploy-preview: |
| 19 |
runs-on: ubuntu-latest |
| 20 |
steps: |
| 21 |
- name: Checkout repository 🛎 |
| 22 |
uses: actions/checkout@v3 |
| 23 |
|
| 24 |
- name: Set up Python |
| 25 |
uses: actions/setup-python@v4 |
| 26 |
with: |
| 27 |
python-version: '3.9' |
| 28 |
|
| 29 |
- name: Install dependencies 📦 |
| 30 |
run: | |
| 31 |
pip install pygments>=1.5 |
| 32 |
pip install -e .[dev] |
| 33 |
|
| 34 |
- name: Build the demo pages 📚 |
| 35 |
run: | |
| 36 |
python test/run_css.py --save-dir docs |
| 37 |
|
| 38 |
- name: Deploy PR Preview |
| 39 |
uses: rossjrw/[email protected] |
| 40 |
with: |
| 41 |
source-dir: docs |
| 42 |
preview-branch: gh-pages |
| 43 |
|
| 44 |
publish-pages: |
| 45 |
runs-on: ubuntu-latest |
| 46 |
needs: deploy-preview |
| 47 |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 48 |
permissions: |
| 49 |
contents: write |
| 50 |
pages: write |
| 51 |
id-token: write |
| 52 |
|
| 53 |
concurrency: |
| 54 |
group: "pages" |
| 55 |
cancel-in-progress: false |
| 56 |
|
| 57 |
environment: |
| 58 |
name: github-pages |
| 59 |
url: ${{ steps.deployment.outputs.page_url }} |
| 60 |
|
| 61 |
steps: |
| 62 |
- name: Checkout repository 🛎 |
| 63 |
uses: actions/checkout@v3 |
| 64 |
|
| 65 |
- name: Set up Python |
| 66 |
uses: actions/setup-python@v4 |
| 67 |
with: |
| 68 |
python-version: '3.9' |
| 69 |
|
| 70 |
- name: Install dependencies 📦 |
| 71 |
run: | |
| 72 |
pip install pygments>=1.5 |
| 73 |
pip install -e .[dev] |
| 74 |
|
| 75 |
- name: Build the demo pages 📚 |
| 76 |
run: | |
| 77 |
python test/render_html.py |
| 78 |
|
| 79 |
- name: Setup Pages 🛠|
| 80 |
uses: actions/configure-pages@v3 |
| 81 |
|
| 82 |
- name: Upload artifact 📥 |
| 83 |
uses: actions/upload-pages-artifact@v1 |
| 84 |
with: |
| 85 |
path: "docs" |
| 86 |
- name: Deploy to GitHub Pages 🚀 |
| 87 |
id: deployment |
| 88 |
uses: actions/deploy-pages@v2 |