Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 827176e

Browse files
authored
ci: Fixup docs CI to run build on all affecting PRs (#3388)
* ci: Fixup docs CI to run build on all affecting PRs * Update CI env vars for GitHub Actions, remove Travis
1 parent 8e68b6a commit 827176e

File tree

8 files changed

+52
-56
lines changed

8 files changed

+52
-56
lines changed

.github/workflows/pull-request-docs.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ on:
1010
- 'docs/**'
1111

1212
jobs:
13+
all_github_action_checks:
14+
runs-on: ubuntu-latest
15+
if: needs.check_non_docs.outputs.run_all_github_action_checks == 'true'
16+
needs:
17+
- check_non_docs
18+
- build_docs
19+
steps:
20+
- run: echo "Done"
21+
1322
check_non_docs:
1423
outputs:
1524
run_all_github_action_checks: ${{ steps.check_files.outputs.run_all_github_action_checks }}
@@ -35,9 +44,15 @@ jobs:
3544
fi
3645
done < files.txt
3746
38-
all_github_action_checks:
47+
build_docs:
3948
runs-on: ubuntu-latest
40-
needs: check_non_docs
41-
if: needs.check_non_docs.outputs.run_all_github_action_checks == 'true'
4249
steps:
43-
- run: echo "Done"
50+
- uses: actions/checkout@v2
51+
- uses: actions/setup-node@v2
52+
with:
53+
node-version: '16'
54+
- name: "Build Docs"
55+
run: |
56+
cd docs/
57+
npm ci
58+
./build.sh

.github/workflows/spl_action.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
on:
1+
name: Docs Publish
22

3+
on:
34
push:
45
branches: [master]
5-
pull_request_target:
6-
branches: [master]
6+
paths:
7+
- 'docs/**'
78

89
jobs:
9-
build:
10+
build:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v2
@@ -15,15 +16,11 @@ jobs:
1516
with:
1617
node-version: '16'
1718
name: "installing the node.js with version 16"
18-
- run: .travis/affects.sh docs/ .travis || exit 0
19+
- name: "Build Docs"
1920
if: ${{ github.event_name == ('push' || 'pull_request')}} && ${{github.ref == 'master'}}
20-
name: "Build Docs"
21-
- run: |
21+
run: |
2222
cd docs/
23-
source .travis/before_install.sh
2423
npm ci
25-
source .travis/script.sh
24+
./build.sh
2625
env:
2726
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
28-
29-

.travis.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.

.travis/affects.sh renamed to ci/affects.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
(
77
set -x
8-
git diff --name-only "$TRAVIS_COMMIT_RANGE"
8+
git diff --name-only "$CI_BASE_BRANCH".."$CI_COMMIT"
99
)
1010

11-
for file in $(git diff --name-only "$TRAVIS_COMMIT_RANGE"); do
11+
for file in $(git diff --name-only "$CI_BASE_BRANCH".."$CI_COMMIT"); do
1212
for prefix in "$@"; do
1313
if [[ $file =~ ^"$prefix" ]]; then
1414
exit 0

ci/env.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ if [[ -n $CI ]]; then
6767
fi
6868
export CI_REPO_SLUG=$APPVEYOR_REPO_NAME
6969
export CI_TAG=$APPVEYOR_REPO_TAG_NAME
70+
elif [[ -n $GITHUB_ACTIONS ]]; then
71+
export CI_BRANCH=$GITHUB_REF
72+
export CI_BASE_BRANCH=$GITHUB_BASE_REF
73+
export CI_BUILD_ID=$GITHUB_RUN_ID
74+
export CI_COMMIT=$GITHUB_SHA
75+
export CI_JOB_ID=$GITHUB_JOB
76+
if [[ -n $GITHUB_HEAD_REF ]]; then
77+
export CI_PULL_REQUEST=true
78+
else
79+
export CI_PULL_REQUEST=
80+
fi
81+
export CI_OS_NAME=$RUNNER_OS
82+
export CI_REPO_SLUG=$GITHUB_REPOSITORY
83+
export CI_TAG=$GITHUB_REF_NAME
7084
fi
7185
else
7286
export CI=

docs/.travis/before_install.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/.travis/script.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ cd "$(dirname "$0")"
66
# shellcheck source=ci/env.sh
77
source ../ci/env.sh
88

9+
# Publish only from merge commits and release tags
10+
if [[ -n $CI ]]; then
11+
if [[ -z $CI_PULL_REQUEST ]]; then
12+
npm install --global docusaurus-init
13+
docusaurus-init
14+
npm install --global vercel
15+
fi
16+
fi
17+
918
# Build from /src into /build
1019
npm run build
1120

0 commit comments

Comments
 (0)