Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
ci: Fixup docs CI to run build on all affecting PRs (#3388)
Browse files Browse the repository at this point in the history
* ci: Fixup docs CI to run build on all affecting PRs

* Update CI env vars for GitHub Actions, remove Travis
  • Loading branch information
joncinque authored Jul 27, 2022
1 parent 8e68b6a commit 827176e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 56 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/pull-request-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
19 changes: 8 additions & 11 deletions .github/workflows/spl_action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}

26 changes: 0 additions & 26 deletions .travis.txt

This file was deleted.

4 changes: 2 additions & 2 deletions .travis/affects.sh → ci/affects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions ci/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
9 changes: 0 additions & 9 deletions docs/.travis/before_install.sh

This file was deleted.

4 changes: 0 additions & 4 deletions docs/.travis/script.sh

This file was deleted.

9 changes: 9 additions & 0 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 827176e

Please sign in to comment.