adds an action to preview docs #35
Workflow file for this run
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
# deploys a preview version of the frontend including example changes | |
name: Preview Docs | |
on: | |
push: | |
branches: | |
- main | |
- build-docs | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-preview: | |
name: Build and deploy | |
runs-on: ubuntu-20.04 | |
env: | |
MODAL_TOKEN_ID: ${{ secrets.MODAL_MODAL_LABS_TOKEN_ID }} | |
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_MODAL_LABS_TOKEN_SECRET }} | |
MODAL_ENVIRONMENT: modal-egs | |
steps: | |
- name: Checkout modal repo | |
uses: actions/checkout@v3 | |
with: | |
repository: modal-labs/modal | |
token: ${{ secrets.GH_PAT }} | |
fetch-depth: 1 | |
path: modal | |
persist-credentials: false | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install base packages | |
shell: bash | |
run: | | |
pip install uv | |
uv pip install --system setuptools wheel | |
- name: Install modal development packages | |
run: | | |
uv pip install --system -r modal/requirements.dev.txt | |
- name: Checkout client repo | |
uses: actions/checkout@v3 | |
with: | |
repository: modal-labs/modal-client | |
token: ${{ secrets.GH_PAT }} | |
path: client | |
fetch-depth: 1 | |
persist-credentials: false | |
- name: Install client repo | |
run: | | |
uv pip install --system -e client | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install node packages | |
run: npm ci --include=dev | |
working-directory: modal/frontend | |
- name: Compile protos | |
run: | | |
cd client | |
inv protoc type-stubs | |
cd ../modal | |
inv protoc | |
- name: Checkout examples repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
path: modal/examples | |
- name: Set up git environment for pull in invoke task | |
working-directory: modal/examples | |
run: | | |
git remote set-url origin https://github.com/modal-labs/modal-examples.git | |
branch_name="${GITHUB_REF#refs/heads/}" | |
git fetch origin $branch_name | |
git checkout $branch_name | |
- name: Build the docs | |
working-directory: modal | |
run: | | |
inv frontend-preview |