Skip to content

Commit 934133f

Browse files
committed
Add GHA workflows to update final branch
1 parent b27b274 commit 934133f

2 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Fetch External Content
2+
3+
on:
4+
schedule:
5+
- cron: '0 4 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
fetch-external:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout main branch
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
21+
- name: Checkout final branch
22+
uses: actions/checkout@v4
23+
with:
24+
ref: final
25+
path: final-branch
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: '.ruby-version'
31+
bundler-cache: false
32+
33+
- name: Run fetch-external-content
34+
run: npm run fetch-external-content
35+
36+
- name: Run prepare-docs
37+
run: npm run prepare-docs
38+
39+
- name: Commit and push changes to final branch
40+
run: |
41+
cd final-branch
42+
git config user.name "openHAB Bot"
43+
git config user.email "info@openhab.org"
44+
45+
# Remove existing directories in final branch checkout
46+
rm -rf docs images addons scripts .vuepress
47+
48+
# Copy updated directories from the main branch workspace
49+
cp -r ../docs ./
50+
cp -r ../images ./
51+
cp -r ../addons ./
52+
cp -r ../scripts ./
53+
cp -r ../.vuepress ./
54+
55+
# Stage the changes
56+
git add docs images addons scripts .vuepress
57+
58+
# Commit and push if there are changes
59+
if git diff --cached --quiet; then
60+
echo "No changes to commit"
61+
else
62+
git commit -m "Automated fetch-external-content update"
63+
git push origin final
64+
fi
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Prepare Docs on Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
prepare-docs:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout main branch
18+
uses: actions/checkout@v4
19+
with:
20+
ref: main
21+
22+
- name: Checkout final branch
23+
uses: actions/checkout@v4
24+
with:
25+
ref: final
26+
path: final-branch
27+
28+
- name: Set up Ruby
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: '.ruby-version'
32+
bundler-cache: false
33+
34+
- name: Run prepare-docs
35+
run: npm run prepare-docs
36+
37+
- name: Commit and push changes to final branch
38+
run: |
39+
cd final-branch
40+
git config user.name "openHAB Bot"
41+
git config user.email "info@openhab.org"
42+
43+
# Remove existing directories in final branch checkout
44+
rm -rf docs images addons scripts .vuepress
45+
46+
# Copy updated directories from the main branch workspace
47+
cp -r ../docs ./
48+
cp -r ../images ./
49+
cp -r ../addons ./
50+
cp -r ../scripts ./
51+
cp -r ../.vuepress ./
52+
53+
# Stage the changes
54+
git add docs images addons scripts .vuepress
55+
56+
# Commit and push if there are changes
57+
if git diff --cached --quiet; then
58+
echo "No changes to commit"
59+
else
60+
git commit -m "Automated prepare-docs update from main branch push"
61+
git push origin final
62+
fi

0 commit comments

Comments
 (0)