Deploying to Forge from Travis CI

script-deployment

#1

I’m attempting to deploy my application to Forge using Travis CI once certain conditions are met. I’d like the dev branch to be deployed to my development server when Travis passes my tests. Likewise, I’d like my master branch to be deployed to my production server when Travis passes my tests.

I have the following .travis.yml file for deploying:-

deploy:
  # deploy dev to development server
  - provider: script
    script: chmod +x ./scripts/deploy_dev.sh
    on:
      branch: dev
  # deploy master to production server
  - provider: script
    script: chmod +x scripts/deploy_prod.sh
    on:
      branch: master

However, when I commit and push to the dev branch, after Travis has done everything and is ready to deploy, I get the following error:- Skipping a deployment with the script provider because this branch is not permitted: dev.

My deployment scripts work fine when I use the after_success: Travis command, all they’re doing is using cURL to send a request to the Forge endpoint to deploy whichever branch.

deploy_dev.sh and deploy_prod.sh

#!/bin/bash

# Trigger deployment
curl -s 'https://forge.laravel.com/servers/*****/sites/*****/deploy/http?token=****************';
echo 'Deployed to Forge'