diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 284d73d0f..91ca485fa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,12 +1,17 @@ name: Build Documentation + on: workflow_dispatch: - workflow_call: inputs: publish: required: true type: boolean + pin-tag: + # pin-tag can be used to keep the latest X.Y.Z release tag instead of + # a X.Y.Z-devN tag when updating the docs after a release + required: false + type: string release: types: [ released ] @@ -18,6 +23,7 @@ env: jobs: build_docs: + if: (!contains(github.event.head_commit.message, '[skip-doc-build]')) || inputs.publish name: Build Documentation runs-on: ubuntu-latest steps: @@ -58,10 +64,20 @@ jobs: restore-keys: | fastf1-doc-cache + - name: Install at pinned tag + if: inputs.pin-tag != '' + run: | + git checkout ${{ inputs.pin-tag }} + - name: Install Fast-F1 from sources run: | python -m pip install -e . + - name: Re-checkout current commit after install at pinned tag + if: inputs.pin-tag != '' + run: | + git checkout ${{ github.sha }} + - name: Create doc build dir run: | mkdir -p docs/_build/html @@ -75,18 +91,28 @@ jobs: - name: Build docs run: | mkdir test_cache # not really need but pytest setup relies on it - cd ./docs - make clean + + # delete all files in build directory, will be replaced with new + # build (don't use "make clean" as it deletes the .git folder) + # need to go to nested git repository in build directory + cd ./docs/_build/html + git rm -r * + + # go back to docs folder in main repository + cd ../.. make html - - name: Publish docs - if: (github.event_name == 'release') || inputs.publish + - name: Prepare docs for publishing run: | cd docs/_build/html git add . git config user.name github-actions git config user.email github-actions@github.com git commit -m "$GITHUB_REF_NAME ($GITHUB_JOB) ci release" + + - name: Publish docs + if: (github.event_name == 'release') || inputs.publish + run: | git push origin gh-pages --force - name: Upload docs as artifact diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml deleted file mode 100644 index 6264aff61..000000000 --- a/.github/workflows/publish_docs.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Publish Documentation - -on: - workflow_dispatch: - -jobs: - publish-docs: - name: Build and Publish Docs - uses: ./.github/workflows/docs.yml - with: - publish: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2fe9f05ea..14e6b22ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,7 @@ env: jobs: run-code-tests: + if: (!contains(github.event.head_commit.message, '[skip-pytest]')) runs-on: ubuntu-latest strategy: fail-fast: false @@ -75,6 +76,7 @@ jobs: run-lint-checks: + if: (!contains(github.event.head_commit.message, '[skip-ruff]')) runs-on: ubuntu-latest name: Linting (Ruff) steps: @@ -111,6 +113,7 @@ jobs: run-isort-test: + if: (!contains(github.event.head_commit.message, '[skip-isort]')) name: Test import order (isort) runs-on: ubuntu-latest @@ -141,6 +144,7 @@ jobs: python -m isort . --check-only run-readme-render-test: + if: (!contains(github.event.head_commit.message, '[skip-readme-test]')) name: Test readme renders on PyPi runs-on: ubuntu-latest