|
| 1 | +name: docs deployment |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: "${{ github.ref }}-${{ github.head_ref }}" |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash -l {0} |
| 14 | + |
| 15 | +jobs: |
| 16 | + docs: |
| 17 | + if: "github.repository == 'MDAnalysis/GridDataFormats'" |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: setup_miniconda |
| 24 | + uses: conda-incubator/setup-miniconda@v2 |
| 25 | + with: |
| 26 | + python-version: 3.7 |
| 27 | + auto-update-conda: true |
| 28 | + channel-priority: flexible |
| 29 | + channels: conda-forge |
| 30 | + add-pip-as-python-dependency: true |
| 31 | + mamba-version: "*" |
| 32 | + |
| 33 | + - name: install package deps |
| 34 | + run: | |
| 35 | + mamba install numpy scipy pytest pytest-cov codecov six sphinx |
| 36 | + pip install sphinx-sitemap sphinx-rtd-theme |
| 37 | +
|
| 38 | + - name: check install |
| 39 | + run: | |
| 40 | + which python |
| 41 | + which pip |
| 42 | + conda info |
| 43 | + conda list |
| 44 | +
|
| 45 | + - name: install package |
| 46 | + run: | |
| 47 | + pip install -v . |
| 48 | +
|
| 49 | + - name: build docs |
| 50 | + run: | |
| 51 | + python setup.py build_sphinx |
| 52 | +
|
| 53 | + - name: deploy docs |
| 54 | + env: |
| 55 | + GIT_CI_USER: github-actions |
| 56 | + GIT_CI_EMAIL: "github-action@users.noreply.github.com" |
| 57 | + MDA_DOCDIR: build/sphinx/html |
| 58 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + GH_REPOSITORY: github.com/MDAnalysis/GridDataFormats.git |
| 60 | + GH_DOC_BRANCH: master |
| 61 | + |
| 62 | + run: | |
| 63 | + cd ${MDA_DOCDIR} |
| 64 | +
|
| 65 | + rev=$(git rev-parse --short HEAD) |
| 66 | +
|
| 67 | + # set up git |
| 68 | + git init |
| 69 | + git config user.name ${GIT_CI_USER} |
| 70 | + git config user.email ${GIT_CI_EMAIL} |
| 71 | + git remote add upstream "https://${GH_TOKEN}@${GH_REPOSITORY}" |
| 72 | + git fetch --depth 50 upstream ${GH_DOC_BRANCH} gh-pages |
| 73 | + git reset upstream/gh-pages |
| 74 | +
|
| 75 | + touch . |
| 76 | + touch .nojekyll |
| 77 | +
|
| 78 | + # comit and push |
| 79 | + git add -A . |
| 80 | + git commit -m "rebuilt html docs from branch ${GH_DOC_BRANCH} with sphinx at ${rev}" |
| 81 | + git push -q upstream HEAD:gh-pages |
0 commit comments