-
Notifications
You must be signed in to change notification settings - Fork 825
Deploy docs via GitHub Actions CI #3053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ env: | |
| MDA_PIP_MIN_DEPS: 'coveralls coverage<5 pytest-cov pytest-xdist' | ||
| MDA_PIP_EXTRA_DEPS: 'duecredit parmed' | ||
|
|
||
|
|
||
| jobs: | ||
| main_tests: | ||
| if: "github.repository == 'MDAnalysis/mdanalysis'" | ||
|
|
@@ -211,9 +212,57 @@ jobs: | |
|
|
||
| - name: deploy_docs | ||
| if: github.event_name != 'pull_request' | ||
| env: | ||
| GH_USER: github-actions | ||
| GH_EMAIL: "github-action@users.noreply.github.com" | ||
| GH_REPOSITORY: "github.com/${{ github.repository }}.git" | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| URL: https://docs.mdanalysis.org | ||
|
|
||
| run: | | ||
| # place the deploy call here | ||
| echo "Oh, maple syrup roast parsnips [Richard Gowers]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Almost a shame to loose this citation ;-) |
||
| # set up environment variables | ||
| # cannot execute bash to make variables in env section | ||
| # export URL for the Python script $UPDATE_JSON | ||
| export URL | ||
| export VERSION=$(cd package/MDAnalysis; python -c 'import version; print(version.__version__)') | ||
| UPDATE_JSON=$(pwd)/maintainer/update_json_stubs_sitemap.py | ||
| BRANCH="${GITHUB_REF#refs/heads/}" | ||
|
|
||
| # the below turns off non-blocking as it causes large writes to stdout to fail | ||
| # (see https://github.com/travis-ci/travis-ci/issues/4704) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment. Btw, I think what we're doing here we enabled blocking mode again, in case it was switched to non-blocking, at least that's how I read travis-ci/travis-ci#4704 (comment) and Was this someone we only needed for Travis or is this a general problem, i.e., does gh-actions also have something weird running that switches to non-blocking mode?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P.S.: Even if we don't strictly need it here anymore, I would only ever comment the line and not delete it, just in case we need it ever again.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing that out @orbeckst; you're right, gh-actions did not have this problem the 2 times I ran the deployment (where Travis was previously failing every time). I've commented it out and left a note. |
||
| # commented out as this is not a problem with gh-actions | ||
| # python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);' | ||
| cd package/doc/html/html | ||
|
|
||
| # move docs into version subfolder | ||
| mkdir ../${VERSION} && mv * ../${VERSION} && mv ../${VERSION} $VERSION | ||
|
|
||
| # set up git | ||
| REV=$(git rev-parse --short HEAD) | ||
| git init | ||
| git config user.name $GH_USER | ||
| git config user.email $GH_EMAIL | ||
| git remote add upstream "https://${GH_USER}:${GH_TOKEN}@${GH_REPOSITORY}" | ||
| git fetch --depth 50 upstream $BRANCH gh-pages | ||
| git reset upstream/gh-pages | ||
|
|
||
| # redirects and copies | ||
| mkdir latest | ||
| python $UPDATE_JSON | ||
| touch . | ||
| touch .nojekyll | ||
|
|
||
| git add -A ${VERSION}/ | ||
| git add .nojekyll versions.json *.xml *.html index.html latest | ||
|
|
||
| for dirname in dev stable documentation_pages ; do | ||
| if [ -d $dirname ]; then git add $dirname; fi | ||
| done | ||
|
|
||
| # check for anything to commit | ||
| # https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes | ||
| git diff-index --quiet HEAD -- || git commit -m "rebuilt html docs for version ${VERSION} from branch ${BRANCH} with sphinx at ${REV}" | ||
| git push -q upstream HEAD:gh-pages | ||
|
|
||
|
|
||
| pylint_check: | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved deployment to within this file because it saved a lot of variable checking and possibly insecure token passing