diff --git a/.github/workflows/pull-request-docs.yml b/.github/workflows/pull-request-docs.yml index 3cba9da0abc..7c02b91f4bf 100644 --- a/.github/workflows/pull-request-docs.yml +++ b/.github/workflows/pull-request-docs.yml @@ -10,6 +10,15 @@ on: - 'docs/**' jobs: + all_github_action_checks: + runs-on: ubuntu-latest + if: needs.check_non_docs.outputs.run_all_github_action_checks == 'true' + needs: + - check_non_docs + - build_docs + steps: + - run: echo "Done" + check_non_docs: outputs: run_all_github_action_checks: ${{ steps.check_files.outputs.run_all_github_action_checks }} @@ -35,9 +44,15 @@ jobs: fi done < files.txt - all_github_action_checks: + build_docs: runs-on: ubuntu-latest - needs: check_non_docs - if: needs.check_non_docs.outputs.run_all_github_action_checks == 'true' steps: - - run: echo "Done" + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: "Build Docs" + run: | + cd docs/ + npm ci + ./build.sh diff --git a/.github/workflows/spl_action.yml b/.github/workflows/spl_action.yml index bebae6acace..09f7a8eee2a 100644 --- a/.github/workflows/spl_action.yml +++ b/.github/workflows/spl_action.yml @@ -1,12 +1,13 @@ -on: +name: Docs Publish +on: push: branches: [master] - pull_request_target: - branches: [master] + paths: + - 'docs/**' jobs: - build: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -15,15 +16,11 @@ jobs: with: node-version: '16' name: "installing the node.js with version 16" - - run: .travis/affects.sh docs/ .travis || exit 0 + - name: "Build Docs" if: ${{ github.event_name == ('push' || 'pull_request')}} && ${{github.ref == 'master'}} - name: "Build Docs" - - run: | + run: | cd docs/ - source .travis/before_install.sh npm ci - source .travis/script.sh + ./build.sh env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} - - diff --git a/.travis.txt b/.travis.txt deleted file mode 100644 index 59949866bd5..00000000000 --- a/.travis.txt +++ /dev/null @@ -1,26 +0,0 @@ -# dist: bionic -# sudo: required - - -# branches: -# only: -# - master - -# notifications: -# email: false - -# jobs: -# include: -# # docs pull request or commit to master -# - name: "Build Docs" -# if: type IN (push, pull_request) AND branch = master -# language: node_js -# node_js: -# - "node" - -# before_install: -# - .travis/affects.sh docs/ .travis || travis_terminate 0 -# - cd docs/ -# - source .travis/before_install.sh -# script: -# - source .travis/script.sh diff --git a/.travis/affects.sh b/ci/affects.sh similarity index 65% rename from .travis/affects.sh rename to ci/affects.sh index 0d6bf3882d6..15808a13554 100755 --- a/.travis/affects.sh +++ b/ci/affects.sh @@ -5,10 +5,10 @@ ( set -x - git diff --name-only "$TRAVIS_COMMIT_RANGE" + git diff --name-only "$CI_BASE_BRANCH".."$CI_COMMIT" ) -for file in $(git diff --name-only "$TRAVIS_COMMIT_RANGE"); do +for file in $(git diff --name-only "$CI_BASE_BRANCH".."$CI_COMMIT"); do for prefix in "$@"; do if [[ $file =~ ^"$prefix" ]]; then exit 0 diff --git a/ci/env.sh b/ci/env.sh index d075b259997..e0d9aa82309 100644 --- a/ci/env.sh +++ b/ci/env.sh @@ -67,6 +67,20 @@ if [[ -n $CI ]]; then fi export CI_REPO_SLUG=$APPVEYOR_REPO_NAME export CI_TAG=$APPVEYOR_REPO_TAG_NAME + elif [[ -n $GITHUB_ACTIONS ]]; then + export CI_BRANCH=$GITHUB_REF + export CI_BASE_BRANCH=$GITHUB_BASE_REF + export CI_BUILD_ID=$GITHUB_RUN_ID + export CI_COMMIT=$GITHUB_SHA + export CI_JOB_ID=$GITHUB_JOB + if [[ -n $GITHUB_HEAD_REF ]]; then + export CI_PULL_REQUEST=true + else + export CI_PULL_REQUEST= + fi + export CI_OS_NAME=$RUNNER_OS + export CI_REPO_SLUG=$GITHUB_REPOSITORY + export CI_TAG=$GITHUB_REF_NAME fi else export CI= diff --git a/docs/.travis/before_install.sh b/docs/.travis/before_install.sh deleted file mode 100644 index 724311cc3a1..00000000000 --- a/docs/.travis/before_install.sh +++ /dev/null @@ -1,9 +0,0 @@ -# |source| this file - -curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - -sudo apt install -y nodejs - -npm install --global docusaurus-init -docusaurus-init - -npm install --global vercel diff --git a/docs/.travis/script.sh b/docs/.travis/script.sh deleted file mode 100644 index a4fee2dabc4..00000000000 --- a/docs/.travis/script.sh +++ /dev/null @@ -1,4 +0,0 @@ -# |source| this file - -set -ex -./build.sh diff --git a/docs/build.sh b/docs/build.sh index dd1255120f5..4f28b54c138 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -6,6 +6,15 @@ cd "$(dirname "$0")" # shellcheck source=ci/env.sh source ../ci/env.sh +# Publish only from merge commits and release tags +if [[ -n $CI ]]; then + if [[ -z $CI_PULL_REQUEST ]]; then + npm install --global docusaurus-init + docusaurus-init + npm install --global vercel + fi +fi + # Build from /src into /build npm run build