-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (141 loc) · 5.12 KB
/
update-docs-base.yml
File metadata and controls
166 lines (141 loc) · 5.12 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Update Docs (Base)
on:
workflow_call:
inputs:
source_branch:
description: 'Source branch to pull docs from'
required: true
type: string
target_branch:
description: 'Target branch to update'
required: true
type: string
annotation:
description: 'Annotation for the update (e.g., nightly, manual)'
required: true
type: string
run_name:
description: 'Custom run name for the workflow'
required: true
type: string
secrets:
METABASE_AUTOMATION_USER_TOKEN:
description: 'GitHub token for automation'
required: true
jobs:
build:
name: ${{ inputs.run_name }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
MAIN_REPO_SOURCE_BRANCH: ${{ inputs.source_branch }}
MAIN_REPO_TARGET_BRANCH: ${{ inputs.target_branch }}
ANNOTATION: ${{ inputs.annotation }}
steps:
- uses: actions/checkout@v4
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "21"
- name: Install Clojure (needed to build cljs for SDK dox generation)
uses: DeLaGuardo/setup-clojure@13.2
with:
cli: 1.12.0.1530
bb: 1.12.200
- name: Run docs repo build tests
run: |
bb script/_test/all.clj
- name: Filter non-documented branches
run: |
bb script/check_incoming_branchname.clj --target-branch "$MAIN_REPO_TARGET_BRANCH"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install js dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Setup Ruby # uses version from .ruby-version
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0
- name: Setup Git Authentication
run: |
git config --global user.name "Metabase Docs bot"
git config --global user.email "metabase-bot@metabase.com"
git remote set-url origin "https://x-access-token:${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}@github.com/metabase/docs.metabase.github.io.git"
# observed this failing during sdk docs generation deps downloads, so adding retry logic
- name: Update docs for branchname
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_on: error
command: |
bb script/update_docs_for_branchname.clj --source-branch "$MAIN_REPO_SOURCE_BRANCH" --target-branch "$MAIN_REPO_TARGET_BRANCH"
- name: Cleanup cloud docs (move them to latest, remove from all other versions)
run: |
bb script/cleanup_cloud_docs.clj
- name: Checkout Control files from Marketing Repo
uses: actions/checkout@v4
with:
repository: metabase/metabase.github.io
ref: master
path: .marketing_repo
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Merge control files from Marketing Repo
run: |
bb script/sync_repo.clj --from-repo .marketing_repo
- name: "yarn lint-markdown"
run: |
yarn lint-markdown
- name: "yarn lint-styles"
run: |
yarn lint-styles
- name: "yarn lint-scripts"
run: |
yarn lint-scripts
- name: "yarn lint-links"
run: |
yarn lint-links
- name: List SDK files (debugging)
run: |
cd _docs/v0.57/embedding/sdk/
ls -lR
- name: Upload Master doc files (debugging)
uses: actions/upload-artifact@v4
with:
name: sdk-files-debug
path: _docs/v0.57/
- name: Build the Jekyll Site
env:
JEKYLL_ENV: production
NODE_ENV: production
run: |
# Clear the existing site:
rm -rf _site
# Build the jekyll site:
script/build
- name: Run htmlproofer + metabase.com-aware link checks
run: |
SECONDS=0
script/links || true
echo "htmlproofer took: ${SECONDS} seconds."
echo 'checking reported links...'
echo "htmlproofer spit out a report of length: $(wc -l < htmlproofer.out)"
bb script/analyze_links.clj --htmlproofer-output htmlproofer.out --limit 1
- name: Update or Create the Pull Request
run: |
bb script/update_or_create_pr.clj \
--source-branch "$MAIN_REPO_SOURCE_BRANCH" \
--target-branch "$MAIN_REPO_TARGET_BRANCH" \
--annotation "$ANNOTATION" \
--pr-number "$PR_NUMBER" \
--update-dirs "$UPDATE_DIRS"
- name: Remove control files from Marketing Repo
run: |
bb script/sync_repo.clj --delete
- name: Merge Updated Docs
run: |
bb script/merge.clj --source-branch "$MAIN_REPO_SOURCE_BRANCH" --target-branch "$MAIN_REPO_TARGET_BRANCH"