-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a separate job to deploy docs using an uploaded artifact. This reduces what code runs in the github pages environment, and also ensures that job/environment is never used for a PR.
- Loading branch information
1 parent
ec1c34a
commit a827d5d
Showing
2 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,9 @@ jobs: | |
# | ||
Docs: | ||
name: ${{ matrix.python-version }} ${{ matrix.dep-versions }} | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
env: | ||
DOC_VERSION: dev | ||
environment: | ||
name: github-pages | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -36,6 +34,8 @@ jobs: | |
- python-version: 3.9 | ||
check-links: true | ||
dep-versions: requirements.txt | ||
outputs: | ||
doc_version: ${{ steps.build-docs.outputs.doc-version }} | ||
|
||
steps: | ||
# We check out only a limited depth and then pull tags to save time | ||
|
@@ -58,20 +58,34 @@ jobs: | |
python-version: ${{ matrix.dep-versions }} | ||
|
||
- name: Build docs | ||
id: build-docs | ||
uses: ./.github/actions/build-docs | ||
with: | ||
run-linkchecker: ${{ github.event_name == 'pull_request' && matrix.check-links == true }} | ||
upload-build: ${{ github.event_name == 'pull_request' }} | ||
key: ${{ runner.os }}-${{ matrix.python-version }} | ||
|
||
Deploy: | ||
if: ${{ github.event_name != 'pull_request' }} | ||
needs: Docs | ||
environment: | ||
name: github-pages | ||
runs-on: ubuntu-latest | ||
env: | ||
DOC_VERSION: dev | ||
|
||
steps: | ||
- name: Download doc build | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Linux-3.9-docs | ||
|
||
# This overrides the version "dev" with the proper version if we're building off a | ||
# branch that's not main (which is confined to n.nn.x above) or on a tag. | ||
- name: Set doc version | ||
if: ${{ github.event_name != 'push' || !contains(github.ref, 'main') }} | ||
run: echo "DOC_VERSION=v$(python -c 'import metpy,re; print(re.search(r"(\d+\.\d+)", metpy.__version__)[0])')" >> $GITHUB_ENV | ||
run: echo "DOC_VERSION=v${{ needs.Docs.outputs.doc-version }}" >> $GITHUB_ENV | ||
|
||
- name: Upload to GitHub Pages | ||
if: ${{ github.event_name != 'pull_request' && matrix.python-version == '3.9' }} | ||
uses: peaceiris/[email protected] | ||
with: | ||
deploy_key: ${{ secrets.GHPAGES_DEPLOY_KEY }} | ||
|