Deploying to Laravel Vapor with GitHub Actions
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
I've been using GitHub Actions more and more as a CI pipeline for my Laravel apps. Following a successful build on the master branch I want to deploy my apps to production which is now starting to be Laravel Vapor. The process is pretty easy.
First, get an API key from Laravel Vapor and add it as a secret to your GitHub project. I use VAPOR_API_TOKEN
as the secret name. You can then reference the API key using the ${{ secrets.VAPOR_API_TOKEN }}
syntax and making it available as an environment variable when you deploy your app.
Finally, you can also pass through the commit ID and message so that Vapor's UI can better distinguish what was contained in the deployment.
If you're deploying to multiple Vapor apps/environments you may consider using a matrix which allows the jobs to run in parallel resulting in faster deployments. In the below example I use multiple Vapor manifests to deploy into two production environments at the same time.