Build assets #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build assets | |
on: | |
push: | |
branches: [ 5.2 ] | |
pull_request: | |
branches: [ 5.2 ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
CI_COMMIT_MESSAGE: Continuous Integration Assets Build Artifacts | |
CI_COMMIT_AUTHOR: Continuous Integration | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: composer update --prefer-dist --no-interaction --no-progress | |
- name: Install npm deps | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install npm deps | |
working-directory: assets | |
run: npm install --install-links | |
- name: Build deps | |
working-directory: assets | |
run: npm run build | |
# Commit and push all changed files. | |
# Must only affect files that are listed in "paths-ignore". | |
- name: GIT Commit Assets Build Artifacts | |
# Only run on main branch push (e.g. pull request merge). | |
# if: github.event_name == 'push' | |
run: | | |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | |
git config --global user.email "[email protected]" | |
git add public | |
git commit -m "${{ env.CI_COMMIT_MESSAGE }}" | |
git push origin ${{ env.BRANCH_NAME }} |