Skip to content

apix23/github-actions-masterclass

Repository files navigation

GitHub Actions Masterclass

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.

What's Inside

Exercises

Exercise 1: Create Your First Workflow

In this exercise, you will create a basic workflow that runs a simple shell command.

  1. Create a new file in the .github/workflows directory named first-workflow.yml.
  2. Define a workflow named "First Workflow".
  3. Configure it to run on every push.
  4. 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!"

Exercise 2: Set Up a Node.js Application

In this exercise, you will create a workflow to set up a Node.js environment.

  1. Create a new file in the .github/workflows directory named node-setup.yml.
  2. Define a workflow named "Node.js Setup".
  3. Configure it to run on every push.
  4. 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

Workflow Files

  • .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.

How to Use This Repository

  1. Clone this repository to your local machine.
  2. Navigate to the .github/workflows directory to explore and edit the example workflows.
  3. Follow the instructions in each exercise to create and execute workflows in your own GitHub repository.

Prerequisites

  • A basic understanding of Git and GitHub (commits, branches, pull requests).
  • Node.js installed locally for testing the second exercise (if desired).

Resources

Start automating your workflows and enhancing your development process with GitHub Actions! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published