-
Notifications
You must be signed in to change notification settings - Fork 17
58 lines (51 loc) · 1.53 KB
/
Copy pathdocs.yml
File metadata and controls
58 lines (51 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Docs
on:
push:
branches: [main]
paths:
- '.github/workflows/docs.yml'
- 'docs-site/**'
pull_request:
paths:
- '.github/workflows/docs.yml'
- 'docs-site/**'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: docs-site
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Skip stale push builds
id: freshness
if: github.event_name == 'push'
working-directory: .
run: |
git fetch --no-tags origin "${GITHUB_REF_NAME}"
latest_sha="$(git rev-parse "origin/${GITHUB_REF_NAME}")"
if [ "${latest_sha}" = "${GITHUB_SHA}" ]; then
echo "should_build=true" >> "${GITHUB_OUTPUT}"
else
echo "should_build=false" >> "${GITHUB_OUTPUT}"
echo "Skipping build: newer commit detected (${latest_sha})."
fi
- uses: actions/setup-node@v4
if: github.event_name != 'push' || steps.freshness.outputs.should_build == 'true'
with:
node-version: 22
cache: npm
cache-dependency-path: docs-site/package-lock.json
- if: github.event_name != 'push' || steps.freshness.outputs.should_build == 'true'
run: npm ci
- if: github.event_name != 'push' || steps.freshness.outputs.should_build == 'true'
run: npm run build