Master GitHub Actions with hands-on labs and exercises. Learn how to automate workflows, run tests, deploy applications, and more using GitHub's powerful automation platform. This repository has everything you need to get started with continuous integration and continuous deployment.
Workflow templates allow everyone in your organization who has permission to create workflows to do so more quickly and easily. When you create a new workflow, you can choose a workflow template and some or all of the work of writing the workflow will be done for you. You can use workflow templates as a starting place to build your custom workflow or use them as-is. This not only saves time, it promotes consistency and best practice across your organization.
Goto GitHub.com and login to your account.
Navigate to Your Profile
-> Your Organizations
-> New Organization
Select appropriate plan for your organization and click on Continue
Fill in the details and complete the setup.
Create a new public repository named .github
in your organization.
Create a directory named workflow-templates
Create your new workflow file octo-organization-ci.yml
inside the workflow-templates
directory and add the following content:
name: Octo Organization CI
on:
push:
branches: [$default-branch]
pull_request:
branches: [$default-branch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run a one-line script
run: echo Hello from Octo Organization
Create a metadata file inside the workflow-templates
directory. The metadata file must have the same name as the workflow file, but instead of the .yml
extension, it must be appended with .properties.json. For example, this file named octo-organization-ci.properties.json
contains the metadata for a workflow file named octo-organization-ci.yml
:
{
"name": "Octo Organization CI",
"description": "This workflow is used to build and test the Octo Organization project.",
"icon": "gear",
"categories": ["Build", "Test"]
}
Commit the changes to the repository.
Navigate to the Actions
tab of the repository.
Here you will find the workflow template that you just created.
Click on the Configure
button to create a new workflow using the template.
Fill in the details and click on Start commit
.
Your new workflow will be created and will start running.
In this lab, you learned how to create workflow templates in your organization. You can use these templates to quickly create new workflows that are consistent and follow best practices.