Skip to content

Update Final Branch Docs #25

Update Final Branch Docs

Update Final Branch Docs #25

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"