Skip to content

Commit 88ec00a

Browse files
committed
ci: Replace artisan key:generate with PHP one-liner (avoids Laravel boot) [skip-act]
1 parent 5fdfe37 commit 88ec00a

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
6161

6262
- name: Generate app key
63-
run: php artisan key:generate --force
63+
run: php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
6464

6565
- name: Run post-install scripts
6666
run: composer run-script post-autoload-dump --ansi --no-interaction
@@ -135,7 +135,7 @@ jobs:
135135
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
136136

137137
- name: Generate app key
138-
run: php artisan key:generate --force
138+
run: php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
139139

140140
- name: Run post-install scripts
141141
run: composer run-script post-autoload-dump --ansi --no-interaction

.github/workflows/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
7979

8080
- name: Generate app key
81-
run: php artisan key:generate --force
81+
run: php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
8282

8383
- name: Run post-install scripts
8484
run: composer run-script post-autoload-dump --ansi --no-interaction

.github/workflows/supply-chain.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
run: |
139139
rm -rf vendor
140140
composer install --no-interaction --prefer-dist --no-progress --no-scripts
141-
php artisan key:generate --force
141+
php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
142142
composer run-script post-autoload-dump --ansi --no-interaction
143143
echo "✅ Fresh install successful"
144144

0 commit comments

Comments
 (0)