Temporal SAE integration #1593
This file contains hidden or 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
| name: Deploy Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - ".vscode/**" | |
| - ".gitignore" | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - ".vscode/**" | |
| - ".gitignore" | |
| release: | |
| types: [published] | |
| workflow_run: | |
| workflows: ["build"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| actions: read | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Important for mike to work properly | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Cache Huggingface assets | |
| uses: actions/cache@v4 | |
| with: | |
| key: huggingface-${{ runner.os }}-3.11-${{ hashFiles('**/pyproject.toml') }} | |
| path: ~/.cache/huggingface | |
| restore-keys: | | |
| huggingface-${{ runner.os }}-3.11- | |
| - name: Load cached Poetry installation | |
| id: cached-poetry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local | |
| key: poetry-${{ runner.os }}-3.11-0 | |
| - name: Install Poetry | |
| if: steps.cached-poetry.outputs.cache-hit != 'true' | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| installer-parallel: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-3.11- | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction | |
| - name: Set Python Path | |
| run: echo "PYTHONPATH=$PYTHONPATH:$PWD" >> $GITHUB_ENV | |
| - name: Configure Git | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| git config user.name github-actions[bot] | |
| git config user.email github-actions[bot]@users.noreply.github.com | |
| - name: Check if release was created | |
| if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' | |
| id: check_release | |
| run: | | |
| # Download the workflow run artifacts to get the outputs | |
| echo "Checking workflow run outputs..." | |
| # The workflow_run event doesn't directly expose job outputs, so we need to check via API | |
| WORKFLOW_RUN_ID="${{ github.event.workflow_run.id }}" | |
| # Get the workflow run jobs | |
| JOBS_RESPONSE=$(gh api repos/${{ github.repository }}/actions/runs/$WORKFLOW_RUN_ID/jobs) | |
| # Check if the release job ran and completed successfully | |
| RELEASE_JOB_CONCLUSION=$(echo "$JOBS_RESPONSE" | jq -r '.jobs[] | select(.name == "release") | .conclusion') | |
| if [ "$RELEASE_JOB_CONCLUSION" = "success" ]; then | |
| echo "release_job_succeeded=true" >> $GITHUB_OUTPUT | |
| echo "Release job succeeded" | |
| else | |
| echo "release_job_succeeded=false" >> $GITHUB_OUTPUT | |
| echo "Release job did not succeed or did not run" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Deploy release docs | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && steps.check_release.outputs.release_job_succeeded == 'true') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Get the release tag | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| RELEASE_TAG=${GITHUB_REF#refs/tags/} | |
| else | |
| # Get the latest tag when triggered by workflow_run | |
| RELEASE_TAG=$(git describe --tags --abbrev=0) | |
| fi | |
| # Deploy the version (this will overwrite if it exists) | |
| poetry run mike deploy --push $RELEASE_TAG | |
| # If stable release (no pre-release identifiers), also update latest alias | |
| if [[ ! "$RELEASE_TAG" =~ (alpha|beta|rc) ]]; then | |
| poetry run mike alias -u --push $RELEASE_TAG latest | |
| poetry run mike set-default --push latest | |
| fi | |
| - name: Deploy main branch docs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| poetry run mike deploy --push --update-aliases dev main | |
| # Only set as default if no stable release exists | |
| if ! poetry run mike list | grep -q "latest"; then | |
| poetry run mike set-default --push dev | |
| fi |