Skip to content

ci: fix deploy

ci: fix deploy #2418

Workflow file for this run

name: Build
on:
pull_request:
types: [opened, synchronize, reopened]
branches-ignore: ['l10n_main*']
release:
types: [created]
workflow_run:
workflows: ['Compress images']
types: [completed]
env:
php-version: '8.2'
node-version: 20
concurrency:
group: Build ${{ github.ref }}
cancel-in-progress: true
jobs:
#############
# Build
#############
build:
runs-on: ubuntu-latest
name: Build Assets
strategy:
fail-fast: false
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: redis
coverage: none
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
# Composer
- name: Validate composer.json and composer.lock
run: composer validate
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer files
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
# Yarn
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: yarn
- name: Install yarn dependencies
run: yarn inst
- name: Lint files
run: yarn run lint:all
- name: Build assets
run: yarn run production
- name: Check if there is any file update needed
id: check
run: |
status=$(git status --porcelain)
if [ -z "$status" ]; then
echo "Nothing to push, already up to date."
else
echo -e "Waiting modifications:\n$status"
echo "::error::Assets are not up to date. Please rebuild with: 'yarn run lint:all' and 'yarn run prod'."
exit -1
fi