Welcome to the GitHub Actions Masterclass repository! This project is designed to help you learn the basics of GitHub Actions through hands-on exercises. Whether you're just starting or looking to deepen your understanding of automating workflows in GitHub, this repository provides practical examples and clear instructions.
In this exercise, you will create a basic workflow that runs a simple shell command.
- Create a new file in the
.github/workflows
directory namedfirst-workflow.yml
. - Define a workflow named "First Workflow".
- Configure it to run on every push.
- Add a job that prints "Hello, World!" to the console.
Here's an example to get you started:
name: First Workflow
on: [push]
jobs:
hola-mundo:
runs-on: ubuntu-latest
steps:
- name: Print Hello
run: echo "Hello, World!"
In this exercise, you will create a workflow to set up a Node.js environment.
- Create a new file in the
.github/workflows
directory namednode-setup.yml
. - Define a workflow named "Node.js Setup".
- Configure it to run on every push.
- Add steps to check out the repository, set up Node.js, install dependencies, and run tests.
Here's an example to get you started:
name: Node.js Setup
on: [push]
jobs:
node-setup:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
.github/workflows/first-workflow.yml
: Contains the "Hello, World!" workflow example..github/workflows/node-setup.yml
: A more advanced example for automating tasks in a Node.js environment.
- Clone this repository to your local machine.
- Navigate to the
.github/workflows
directory to explore and edit the example workflows. - Follow the instructions in each exercise to create and execute workflows in your own GitHub repository.
- A basic understanding of Git and GitHub (commits, branches, pull requests).
- Node.js installed locally for testing the second exercise (if desired).
Start automating your workflows and enhancing your development process with GitHub Actions! 🚀