Skip to content

Rebuild repository #1168

Rebuild repository

Rebuild repository #1168

Workflow file for this run

name: Rebuild repository
env:
TARGET_BRANCH: gh-pages
TARGET_DIRECTORY: './web'
BUILDER_DIRECTORY: './builder'
on:
push:
branches:
- 'master'
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: xdebug-2.9.8
- name: Pull source
uses: actions/checkout@v3
- name: Install repository-builder
uses: actions/checkout@v3
with:
repository: 'phpcq/repository-builder'
path: ${{ env.BUILDER_DIRECTORY }}
- name: Cache composer cache directory
uses: actions/cache@v3
env:
cache-name: composer-cache-dir
with:
path: ~/.cache/composer
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Cache vendor directory of repository-builder
uses: actions/cache@v3
env:
cache-name: repository-builder-vendor
with:
path: ${{ env.BUILDER_DIRECTORY }}/vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Cache var directory of repository-builder
uses: actions/cache@v3
env:
cache-name: repository-builder-var-${{ secrets.VAR_CACHE_VERSION }}
with:
path: ${{ env.BUILDER_DIRECTORY }}/var
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./sources.yaml') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ env.cache-name }}-
- name: Install dependencies
run: composer install
working-directory: ${{ env.BUILDER_DIRECTORY }}
- name: Checkout target directory
uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_BRANCH }}
path: ${{ env.TARGET_DIRECTORY }}
- name: Rebuild repository
id: rebuild
run: |
echo "COMMIT_MSG<<EOF" >> $GITHUB_ENV
${{ env.BUILDER_DIRECTORY }}/bin/console phpcq:rebuild -v --truncate=10000 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.BUILDER_GITHUB_TOKEN }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ${{ env.COMMIT_MSG }}
branch: ${{ env.TARGET_BRANCH }}
repository: ${{ env.TARGET_DIRECTORY }}
commit_user_name: PHP Code Quality Bot
commit_user_email: [email protected]
commit_author: PHP Code Quality Bot <[email protected]>