-
-
Notifications
You must be signed in to change notification settings - Fork 733
81 lines (67 loc) · 2.16 KB
/
Copy pathupdate_final_branch_docs.yml
File metadata and controls
81 lines (67 loc) · 2.16 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
name: Update Final Branch Docs
on:
push:
branches:
- main
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v7
with:
ref: main
- name: Checkout final branch
uses: actions/checkout@v7
with:
ref: final
path: final-branch
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '.ruby-version'
bundler-cache: false
- name: Run fetch-external-content
run: ruby scripts/fetch-external-content.rb
- name: Run prepare-docs
run: ruby scripts/prepare-docs.rb --no-placeholders
- name: Configure Git
run: |
git config --global user.name "openhab-bot"
git config --global user.email "bot@openhab.org"
- name: Update files in final branch
working-directory: final-branch
run: |
# Remove existing directories in final branch checkout
rm -rf docs images addons scripts .vuepress
# Copy updated directories from the main branch workspace
cp -r ../docs ./
cp -r ../images ./
cp -r ../addons ./
cp -r ../scripts ./
cp -r ../.vuepress ./
# Stage the changes
git add docs images addons scripts .vuepress
- name: Commit and push if changed
id: commit_push
working-directory: final-branch
run: |
if git diff --cached --quiet; then
echo "committed=false" >> $GITHUB_OUTPUT
echo "No changes to commit"
else
git commit -m "[ci] Automated docs update from main branch & fetch-external-content"
git push origin final
echo "committed=true" >> $GITHUB_OUTPUT
fi
- name: Trigger Netlify build for next.openhab.org
if: steps.commit_push.outputs.committed == 'true'
env:
NETLIFY_HOOK: ${{ secrets.NETLIFY_HOOK }}
run: |
curl -X POST -d {} "https://api.netlify.com/build_hooks/$NETLIFY_HOOK"