Next, create a repo on GitHub and push the new application to the repo. You can follow the instructions here.
I went ahead and created a repository on GitHub containing the application, which can be found at https://github.com/ammezie/laravel-github-actions in case you would like to just clone it instead.
Setting up GitHub Actions
Now, let’s set up GitHub Actions for the repository. Click on the Actions tab on the repository navigational menu.
GitHub is smart enough to know that the repository contains PHP (Laravel) code, so we are presented with starter workflows related to those.
We’ll be going with the one on Laravel then commit the file. This will create a new .github/workflows/laravel.yml file in the repository.
Click on the Actions tab again, and you should see the list of all workflows similar to the image below:
Understanding GitHub Actions Workflow
We have created our first GitHub Action workflow, let’s take a moment to understand what a workflow is. GitHub Actions comprises workflows, which are defined inside the .github/workflows directory within the repository and committed as part of the repository. These are YAML files, which contain data like the name of the workflow, when it should be run, as well as the jobs and steps it needs to run.
Essentially, when an event (commit, push, pull request, etc.) occurs on a repository, GitHub Actions will automatically detect and parse the workflow, then start processing the jobs defined there in.
Taking a look at the generated laravel.yml file, the workflow will run whenever a push or pull request is made to the master
branch: