CD #4
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: CD | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
bun: [1.0] | |
php: [8.2] | |
dependencies: [highest] | |
experimental: [false] | |
name: 🚀 Deploy with PHP-${{ matrix.php }} ${{ matrix.dependencies }} and Bun-${{ matrix.bun }} on ${{ matrix.os }} | |
steps: | |
- name: 🚚 Get latest code | |
uses: actions/checkout@v4 | |
- name: 🎉 Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: ${{ matrix.bun }} | |
- name: 🔨 Install dependencies | |
run: | | |
bun install | |
bun run e2e.install | |
- name: 📂 Cache dependencies | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-dependencies-php-${{ matrix.php }}-composer- | |
- name: ✨ Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl, dom, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip | |
ini-values: error_reporting=E_ALL | |
tools: composer:v2 | |
- name: 🔧 Install Composer dependencies | |
run: | | |
composer install -q --no-ansi --no-cache --no-interaction --no-scripts --no-progress --prefer-dist | |
composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist | |
- name: 🧑💻 Configure environment | |
run: | | |
cp .env.example .env.ci | |
set -e | |
sed -i "s|^\(APP_ENV=\s*\).*$|\1ci|" .env.ci | |
printf "The complete `.env.ci` ... \n\n" | |
cat .env.ci | |
- name: 🔒️ Generate Key | |
run: | | |
set -e | |
php artisan key:generate --env=ci | |
php artisan queue:restart --env=ci | |
- name: 🔐 Directory Permissions | |
run: | | |
chmod -R 777 storage bootstrap/cache | |
chmod -R 777 storage/ | |
- name: ⚡️ Optimize Stuffs | |
run: set -e && php artisan optimize --env=ci | |
- name: 📦️ Compile assets | |
run: bun run build | |
- name: 🏆 Execute end-to-end testing | |
run: bun e2e |