From f0bcf71082f52e7c5a94e8c2fa655cb3c8cf77f7 Mon Sep 17 00:00:00 2001 From: Bruno Sanchez-Andrade Nuno Date: Tue, 26 Dec 2023 21:22:31 +0100 Subject: [PATCH] new workflow --- .github/workflows/deploy-docs.yml | 50 -------------------- .github/workflows/deploy_nbdev.yml | 10 ++++ .github/workflows/quarto-ghp/action.yml | 63 +++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/deploy-docs.yml create mode 100644 .github/workflows/deploy_nbdev.yml create mode 100644 .github/workflows/quarto-ghp/action.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index 3a5abf90..00000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Deploy to GitHub Pages -on: - push: - branches: [master, nbdev] - workflow_dispatch: - -permissions: - contents: write - -jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - name: Configure GitHub Pages - uses: actions/configure-pages@v3 - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.9' - cache: "pip" - cache-dependency-path: settings.ini - - name: Install Dependencies - env: - USE_PRE: '' - TORCH_CPU: true - shell: bash - run: | - set -ux - python -m pip install --upgrade pip - if [ $USE_PRE ]; then - pip install -Uq git+https://github.com/fastai/ghapi.git - pip install -Uq git+https://github.com/fastai/fastcore.git - pip install -Uq git+https://github.com/fastai/execnb.git - pip install -Uq git+https://github.com/fastai/nbdev.git - wget -q $(curl https://latest.fast.ai/pre/quarto-dev/quarto-cli/linux-amd64.deb) - sudo dpkg -i quarto*.deb - else - pip install -Uq nbdev - fi - if [ $TORCH_CPU ]; then - test -f setup.py && pip install -e ".[dev]" --extra-index-url https://download.pytorch.org/whl/cpu - else - test -f setup.py && pip install -e ".[dev]" - fi - cd docs && nbdev_docs - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4.4.3 - with: - branch: gh-pages # The branch the action should deploy to. - folder: docs/_docs/ # The folder the action should deploy. diff --git a/.github/workflows/deploy_nbdev.yml b/.github/workflows/deploy_nbdev.yml new file mode 100644 index 00000000..042c32ee --- /dev/null +++ b/.github/workflows/deploy_nbdev.yml @@ -0,0 +1,10 @@ +name: Deploy to GitHub Pages +on: + push: + branches: [master, nbdev] + workflow_dispatch: +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: quarto-ghp \ No newline at end of file diff --git a/.github/workflows/quarto-ghp/action.yml b/.github/workflows/quarto-ghp/action.yml new file mode 100644 index 00000000..69c7f666 --- /dev/null +++ b/.github/workflows/quarto-ghp/action.yml @@ -0,0 +1,63 @@ +name: 'build-docs' +description: 'Create docs with nbdev' +inputs: + pre: + description: 'Install prerelease nbdev/execnb from master?' + required: false + default: '' + version: + description: 'Version of python to set up' + required: false + default: '3.9' + ghtoken: + description: 'GitHub token' + default: ${{ github.token }} + required: false + torch_cpu: + description: "Install PyTorch CPU instead of PyTorch Cuda. Has no effect if PyTorch isn't a requirement. Enabled by defaut." + required: false + default: true + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.version }} + cache: "pip" + cache-dependency-path: settings.ini + - name: Install Dependencies + env: + USE_PRE: ${{ inputs.pre }} + TORCH_CPU: "${{ inputs.torch_cpu }}" + shell: bash + run: | + set -ux + python -m pip install --upgrade pip + if [ $USE_PRE ]; then + pip install -Uq git+https://github.com/fastai/ghapi.git + pip install -Uq git+https://github.com/fastai/fastcore.git + pip install -Uq git+https://github.com/fastai/execnb.git + pip install -Uq git+https://github.com/fastai/nbdev.git + wget -q $(curl https://latest.fast.ai/pre/quarto-dev/quarto-cli/linux-amd64.deb) + sudo dpkg -i quarto*.deb + else + pip install -Uq nbdev + fi + if [ $TORCH_CPU ]; then + test -f setup.py && pip install -e ".[dev]" --extra-index-url https://download.pytorch.org/whl/cpu + else + test -f setup.py && pip install -e ".[dev]" + fi + cd docs && nbdev_docs + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ inputs.ghtoken }} + force_orphan: true + publish_dir: ./_docs + # The following lines assign commit authorship to the official GH-Actions bot for deploys to `gh-pages` branch. + # You can swap them out with your own user credentials. + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com