Deployments are triggered by committing to Git and pushing to GitHub.
- Create a new file called
./build.sh
and paste the code snippet below. - Run
chmod +x build.sh
on your terminal to make sure the file can be executed when deploying. - Import a new site in your Vercel account
- Link the site to your desired GitHub repository
- Add build command
./build.sh
- Set output directory to
storage/app/static
- Add environment variable in your project settings:
APP_KEY
<copy & paste from dev>
Code for build.sh
Add the following snippet to build.sh
file to install PHP, Composer, and run the ssg:generate
command:
#!/bin/sh # Install PHP & WGETyum install -y amazon-linux-extrasamazon-linux-extras enable php8.2yum clean metadatayum install php php-{common,curl,mbstring,gd,gettext,bcmath,json,xml,fpm,intl,zip,imap}yum install wget # INSTALL COMPOSEREXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]then >&2 echo 'ERROR: Invalid installer checksum' rm composer-setup.php exit 1fi php composer-setup.php --quietrm composer-setup.php # INSTALL COMPOSER DEPENDENCIESphp composer.phar install # GENERATE APP KEYphp artisan key:generate # BUILD STATIC SITEphp please ssg:generate