This workflow uses the on block to specify that it should be triggered on
pushes to the staging branch and pull requests to the master branch.
The jobs block defines a single job called build-and-deploy. This job runs
on an Ubuntu 20.04 (Focal) environment and consists of seven steps:
- Checkout code
- Install Composer dependencies
- Run Laravel Artisan commands
- Install npm dependencies
- Run Vue.js build script (prod mode)
- Deploy to environment using the
appleboy/ssh-actionaction - Set DEPLOY_TO_DOMAIN environment variable based on the branch being pushed or the pull request being merged.
The secrets block defines four separate secrets for staging and production
environments:
DEPLOY_TO_STAGING_KEYDEPLOY_TO_STAGING_HOSTDEPLOY_TO_STAGING_USERNAMEDEPLOY_TO_PRODUCTION_KEYDEPLOY_TO_PRODUCTION_HOSTDEPLOY_TO_PRODUCTION_USERNAME
These secrets are used in the deployment script to determine which environment to deploy to based on the branch being pushed or the pull request being merged.