From 26a1a8ee2ce8745dd9de2138b013c20311f990a4 Mon Sep 17 00:00:00 2001 From: Henrique Branco Date: Sat, 12 Oct 2024 19:03:08 -0300 Subject: [PATCH] chore: realiza build do livro ao abrir PR --- .github/workflows/build_and_deploy.yml | 85 +++++++++++++++++--------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 4abf4c0..b25002f 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -1,30 +1,55 @@ -name: Build e deploy do livro - -on: [push] - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Setup GitHub Actions - uses: actions/checkout@v3 - - - name: Set up Python 3.9 - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - - name: Instalação jupyter-book - run: pip install jupyter-book - - - name: Build do livro - run: jupyter-book build ./book - - # Push the book's HTML to github-pages - - name: GitHub Pages action - uses: peaceiris/actions-gh-pages@v3.6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./book/_build/html \ No newline at end of file +name: Build e deploy do livro + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-and-deploy: + if: github.event_name == 'push' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Setup GitHub Actions + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + + - name: Instalação jupyter-book + run: pip install jupyter-book + + - name: Build do livro + run: jupyter-book build ./book + + # Push the book's HTML to github-pages + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./book/_build/html + + build-only: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Setup GitHub Actions + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + + - name: Instalação jupyter-book + run: pip install jupyter-book + + - name: Build do livro + run: jupyter-book build ./book \ No newline at end of file