name: Run Build on renovate update related to build

on:
  push:
    branches:
      - "renovate/rollup-**"

permissions:
  contents: write

jobs:
  run-rollup-build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ssh-key: ${{ secrets.PUSH_DEPLOY_KEY }}

      - $ciPreStep$

      - uses: actions/setup-node@v6
        with:
          node-version: 24

      - name: Install Dependencies
        run: $installOnCICommand$

      - name: Run Build
        run: $pmExec$ build

      - name: Check for added or modified files
        id: git-check-modified
        run: if [[ -z $(git status -s) ]]; then echo "modified=false" >> $GITHUB_OUTPUT ; else echo "modified=true" >> $GITHUB_OUTPUT ; fi

      - name: Commit report
        if: steps.git-check-modified.outputs.modified == 'true'
        run: |
          git add .
          git -c user.name="Christophe Hurpeau" \
            -c user.email="christophehurpeau@users.noreply.github.com" \
            commit -m "build: update dist" --author="github-actions[bot] <actions@github.com>"
          git push --no-verify
