From 39b53471c5c5de4e8d0b8f44ddfe7d1ed727fffa Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Sat, 3 Oct 2020 08:51:47 -0500 Subject: [PATCH] Use netlify action --- .github/workflows/build_book.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_book.yaml b/.github/workflows/build_book.yaml index d2ed13f..5bc0616 100644 --- a/.github/workflows/build_book.yaml +++ b/.github/workflows/build_book.yaml @@ -4,6 +4,9 @@ on: name: bookdown +env: + isExtPR: ${{ github.event.pull_request.head.repo.fork == true }} + jobs: build: runs-on: ubuntu-16.04 @@ -66,10 +69,18 @@ jobs: uses: actions/setup-node@v1 - name: Deploy to Netlify - # NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID added in the repo's secrets + if: contains(env.isExtPR, 'false') + id: netlify-deploy + uses: nwtgck/actions-netlify@v1.1 + with: + publish-dir: './_book' + production-branch: master + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: + 'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})' + enable-pull-request-comment: false + enable-commit-comment: false env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - run: | - npm install netlify-cli -g - netlify deploy --prod --dir _book + timeout-minutes: 1