Add coiled as funder #144
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: Build and preview Sphinx site | |
on: | |
pull_request: | |
branches: [ master ] | |
paths: [ 'docs/**' ] | |
jobs: | |
build_and_preview: | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install doc env | |
run: | | |
python -m pip install -r docs/requirements.txt | |
- uses: taminomara/[email protected] | |
- name: Build docs | |
run: | | |
cd docs | |
make html | |
- name: Commit documentation changes to preview branch | |
run: | | |
if git clone https://github.com/pangeo-data/pangeo.git --branch ${{ github.head_ref }}-preview --single-branch gh-pages ; then | |
cd gh-pages | |
echo "COMMENT_ON_PR=false" >> $GITHUB_ENV | |
else | |
git clone https://github.com/pangeo-data/pangeo.git --branch gh-pages --single-branch gh-pages | |
cd gh-pages | |
git checkout -b ${{ github.head_ref }}-preview | |
echo "COMMENT_ON_PR=true" >> $GITHUB_ENV | |
fi | |
cp -r ../docs/_build/html/* . | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
- name: Push documentation changes to preview branch | |
uses: ad-m/github-push-action@master | |
with: | |
branch: ${{ github.head_ref }}-preview | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Leave comment on pull request | |
if: env.COMMENT_ON_PR == 'true' | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Thank you for your contributions!\n\nA preview of your changes can be viewed at:\n- https://raw.githack.com/pangeo-data/pangeo/${{ github.head_ref }}-preview/index.html' | |
}) | |
build: | |
if: github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install doc env | |
run: | | |
python -m pip install -r docs/requirements.txt | |
- uses: taminomara/[email protected] | |
- name: Build docs | |
run: | | |
cd docs | |
make html |