This Github Action is no longer maintained, and has been removed from the Github Marketplace.
While this package will remain available/installable for the forseeable future, this package WILL NOT be receiving any further (security) updates going forward. Instead, you are recommended to use the significantly faster and more flexible approach as documented below:
Please note that you will need an active Laravel Vapor subscription.
In order to authenticate with Vapor from Github Actions, we will need to add a VAPOR_API_TOKEN
secret to your repository.
To do so, you may do the following:
- On GitHub, navigate to the main page of the repository you intend to use this action on.
- Under your repository name, click
Settings
. - In the left sidebar, click
Secrets
. - Click
Add a new secret
. - For the name of your secret, enter
VAPOR_API_TOKEN
. - For the value itself, enter your Laravel Vapor API token. You may generate one in your Vapor API settings dashboard.
- Click
Add secret
.
Next, let's head over to the Actions
page, and create a new workflow.
To keep things simple, let's set up an action that deploys to production as soon as a branch is merged into master:
name: Deploy to production
on:
push:
branches: [ master ]
jobs:
vapor:
name: Check out, build and deploy using Vapor
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:v2
coverage: none
- name: Require Vapor CLI
run: composer global require laravel/vapor-cli
- name: Deploy Environment
run: vapor deploy
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
The above does a few things:
- It does a git checkout out your Laravel App (your repository) using the
actions/checkout
action. - It prepares your PHP environment using the amazing shivammathur/setup-php.
- It installs the Laravel Vapor CLI using Composer.
- It executes the
vapor
CLI command using thedeploy
argument.
If you would like to find out more regarding the syntax used by Github Actions, you can take a look at this page.