- Automate, customize, and execute your software development workflows right in your GitHub repository
- GitHub Actions is a CI/CD (Continuous Integration/Continuous Deployment) solution provided by GitHub.
- You may ask yourself "What is a GitHub action?" everything is on the
github-actions
documentation
Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.
To create a new workflow:
- Go to your GitHub repository.
- Click on the Actions tab.
- Click on set up a workflow yourself if you want to create a custom workflow, or you can choose a template.
- Create a new file
.github/workflows/hello.yml
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run a one-line script
run: echo Hello, world!
- Commit to your repository to launch the action
You can trigger a GitHub Actions workflow on a specific branch by specifying the branch name in the on section of your workflow file.
- Create another file
.github/workflows/hello-branch.yml
name: CI
on:
push:
branches:
- main # This workflow will only run when changes are pushed to the 'main' branch
pull_request:
branches:
- main # This workflow will also run when pull requests are opened to the 'main' branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run a one-line script
run: echo Hello, world!
After the exercice, to remember what you've just learned, then fill out the elaboration and feedback form.