rename and update gha workflow to sync boostlook.css across repos

- renamed workflow file from update-website-v2.yml to sync-boostlook-css.yml
- simplified commit process to push changes directly to develop branch if updates are detected
- added steps to trigger ui-release and publish workflows in website-v2-docs repository
- ensured pre-commit hooks are run before committing updates

fixes #44
This commit is contained in:
Julio Estrada
2024-11-25 09:12:53 -05:00
committed by Julio C. Estrada
parent c28cc7213c
commit 3487d92ec4

View File

@@ -1,23 +1,21 @@
name: Update boostlook.css in website-v2 repository
name: Sync boostlook.css to website-v2 and website-v2-docs repositories
on:
push:
branches: [ "develop" ]
branches: ["develop"]
paths:
- 'boostlook.css'
- "boostlook.css"
permissions:
pull-requests: write
contents: write
jobs:
update-css:
runs-on: ubuntu-latest
if: github.repository == 'boostorg/boostlook'
steps:
- name: Checkout boostlook repository
- name: Checkout current repository
uses: actions/checkout@v4
with:
repository: boostorg/boostlook
- name: Checkout website-v2 repository
uses: actions/checkout@v4
@@ -30,24 +28,21 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: "3.11"
- name: Copy boostlook.css to website-v2
run: |
cp -v boostlook.css website-v2/static/css/boostlook.css
- name: Install pre-commit
if: success()
run: |
pip install pre-commit
- name: Run pre-commit hooks on boostlook.css
if: success()
working-directory: website-v2
run: |
pre-commit run --files static/css/boostlook.css
- name: Commit and push changes to a new branch
- name: Commit and push changes to develop branch
if: success()
working-directory: website-v2
env:
@@ -57,14 +52,16 @@ jobs:
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add static/css/boostlook.css
if ! git diff-index --quiet HEAD; then
git commit -m "Update boostlook.css from boostlook repository"
branch_name="update-boostlook-css-$(date +'%Y%m%d%H%M%S')"
git checkout -b "$branch_name"
git push origin "$branch_name"
gh pr create --title "Update boostlook.css from boostlook repository" \
--body "Automated PR to update boostlook.css" \
--base develop \
--head "$branch_name"
git commit -m "chore: Update boostlook.css from boostlook repository [skip ci]"
git push origin develop
else
echo "No changes to commit. Skipping PR creation."
echo "No changes to commit. Skipping commit to develop."
fi
- name: Trigger website-v2-docs ui-release workflow
if: success()
run: |
gh workflow run ui-release.yml --repo boostorg/website-v2-docs --ref develop
- name: Trigger website-v2-docs publish workflow
if: success()
run: |
gh workflow run publish.yml --repo boostorg/website-v2-docs --ref develop