Feature/home page #41
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: github pages | |
on: | |
push: | |
branches: | |
- master | |
pull_request_target: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 1' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
env: | |
PR_PATH: pull/${{github.event.number}} | |
BASE_URL: https://dipy.github.io/dipy.org | |
HEAD: ${{ github.event.pull_request.head.repo.full_name }} | |
BASE: ${{ github.repository }} | |
NB: ${{github.event.number}} | |
REF: ${{github.ref}} | |
STATUS: ${{github.event.pull_request.head.repo.full_name != github.repository}} | |
steps: | |
- name: Comment on PR | |
uses: hasura/[email protected] | |
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "Starting deployment of preview ⏳..." | |
- name: Checkout website repo | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build website | |
run: | | |
make -C . html | |
- name: Upload HTML | |
uses: actions/upload-artifact@v1 | |
with: | |
name: DocumentationHTML | |
path: _build/html/ | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == github.repository }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: ${{ github.event.head_commit.message }} | |
# cname: ${{ env.DOMAIN # TODO: set this if you're using a custom domain. | |
- name: Deploy to PR preview | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html | |
destination_dir: ${{ env.PR_PATH }} | |
keep_files: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: ${{ github.event.head_commit.message }} | |
- name: Update comment | |
uses: hasura/[email protected] | |
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }}/${{ env.PR_PATH }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | |