Use codecov github action #1992
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
name: Docs Site | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: [released] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Docs Deploy | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "noreply@github.com" | |
- name: Check if this is the latest release | |
run: | | |
LATEST_TAG=$( | |
curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ github.token }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/latest \ | |
| jq -r '.tag_name' | |
) | |
IS_LATEST=${{ env.LATEST_TAG == github.event.release.tag_name }} | |
echo This release is: "${{ github.event.release.tag_name }}" | |
echo The latest release is: "$LATEST_TAG" | |
echo "IS_LATEST_RELEASE=$IS_LATEST" >> "$GITHUB_ENV" | |
- name: Install docs dependencies | |
working-directory: doc-site | |
run: pip install -r requirements.txt | |
- name: Update doc site for release | |
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE != 'true' }} | |
working-directory: doc-site | |
run: mike deploy ${{ github.event.release.tag_name }} --push | |
- name: Update doc site for latest release | |
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE == 'true' }} | |
working-directory: doc-site | |
run: mike deploy ${{ github.event.release.tag_name }} latest -u --push | |
- name: Update doc site for `main` branch | |
if: ${{ github.event_name == 'push' }} | |
working-directory: doc-site | |
run: mike deploy head --push | |
- name: Test building the doc site but do not deploy it | |
if: ${{ github.event_name == 'pull_request' }} | |
working-directory: doc-site | |
run: mkdocs build |