Merge pull request #1212 from IntelPython/remove/setup.cfg #4
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: | |
- main | |
- release* | |
tags: | |
- '[0-9]+.[0-9]+*' | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
paths: | |
- 'docs/**' | |
- environment/docs.yml | |
jobs: | |
main: | |
if: ${{ !(github.event.pull_request && github.event.action == 'closed') }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: '3.10' | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: "docs" | |
channels: conda-forge,nodefaults | |
channel-priority: "disabled" | |
environment-file: "environment/docs.yml" | |
- name: Build numba-dpex | |
run: | | |
export PATH=$CONDA/bin-llvm:$PATH | |
python setup.py develop | |
- name: Make documentation | |
working-directory: docs | |
run: make html | |
- name: GitHub Pages [main] | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html/ | |
destination_dir: ./dev | |
allow_empty_commit : true | |
commit_message: ${{ github.event.head_commit.message }} | |
publish_branch: gh-pages | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
- name: GitHub Pages [PR] | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event.pull_request && github.event.action != 'closed' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html/ | |
destination_dir: ./pull/${{ github.event.number }} | |
allow_empty_commit : true | |
commit_message: ${{ github.event.head_commit.message }} | |
publish_branch: gh-pages | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
- name: Comment PR [docs created] | |
if: ${{ github.event.pull_request && github.event.action != 'closed' }} | |
env: | |
PR_NUM: ${{ github.event.number }} | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
Documentation preview: [show](https://intelpython.github.io/numba-dpex/pull/${{ env.PR_NUM }}). | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish release | |
if: startsWith(github.ref, 'refs/heads/release') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
destination_dir : next_release | |
publish_dir: docs/_build/html/ | |
allow_empty_commit : true | |
commit_message: ${{ github.event.head_commit.message }} | |
- name: Capture tag | |
id: capture_tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo ::set-output name=tag_number::${GITHUB_REF#refs/tags/} | |
- name: Publish tag | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
destination_dir : ${{ steps.capture_tag.outputs.tag_number }} | |
publish_dir: docs/_build/html/ | |
allow_empty_commit : true | |
commit_message: ${{ github.event.head_commit.message }} | |
clean: | |
if: ${{ github.event.pull_request && github.event.action == 'closed' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: GitHub Pages [PR closed] | |
env: | |
PR_NUM: ${{ github.event.number }} | |
shell: bash -l {0} | |
run: | | |
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/numba-dpex.git | |
git fetch tokened_docs | |
git checkout --track tokened_docs/gh-pages | |
echo `pwd` | |
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM} | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git commit -m "Removing docs for closed pull request ${PR_NUM}" | |
git push tokened_docs gh-pages | |
- name: Comment PR [docs removed] | |
uses: mshick/add-pr-comment@v1 | |
with: | |
message: | | |
Documentation preview removed. | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
repo-token-user-login: 'github-actions[bot]' | |
allow-repeats: true |