Automating Workflows with GitHub Actions

Book description

Build, test, and deploy code right from your GitHub repository by automating, customizing, and executing software development workflows with GitHub Actions

Key Features

  • Enhance your CI/CD and DevOps workflows using GitHub Actions
  • Discover how to create custom GitHub Actions using Docker and JavaScript
  • Get up and running with building a CI/CD pipeline effectively

Book Description

GitHub Actions is one of the most popular products that enables you to automate development tasks and improve your software development workflow. Automating Workflows with GitHub Actions uses real-world examples to help you automate everyday tasks and use your resources efficiently.

This book takes a practical approach to helping you develop the skills needed to create complex YAML files to automate your daily tasks. You'll learn how to find and use existing workflows, allowing you to get started with GitHub Actions right away. Moving on, you'll discover complex concepts and practices such as self-hosted runners and writing workflow files that leverage other platforms such as Docker as well as programming languages such as Java and JavaScript. As you advance, you'll be able to write your own JavaScript, Docker, and composite run steps actions, and publish them in GitHub Marketplace! You'll also find instructions to migrate your existing CI/CD workflows into GitHub Actions from platforms like Travis CI and GitLab. Finally, you'll explore tools that'll help you stay informed of additions to GitHub Actions along with finding technical support and staying engaged with the community.

By the end of this GitHub book, you'll have developed the skills and experience needed to build and maintain your own CI/CD pipeline using GitHub Actions.

What you will learn

  • Get to grips with the basics of GitHub and the YAML syntax
  • Understand key concepts of GitHub Actions
  • Find out how to write actions for JavaScript and Docker environments
  • Discover how to create a self-hosted runner
  • Migrate from other continuous integration and continuous delivery (CI/CD) platforms to GitHub Actions
  • Collaborate with the GitHub Actions community and find technical help to navigate technical difficulties
  • Publish your workflows in GitHub Marketplace

Who this book is for

This book is for anyone involved in the software development life cycle, for those looking to learn about GitHub Actions and what can be accomplished, and for those who want to develop a new skill to help them advance their software development career. If you are new to GitHub and GitHub Actions in general, then this book is for you. Basic knowledge of GitHub as a platform will help you to get the most out of this book.

Table of contents

  1. Automating Workflows with GitHub Actions
  2. Contributors
  3. About the author
  4. About the reviewer
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the color images
    5. Conventions used
    6. Get in touch
    7. Share Your Thoughts
  6. Section 1:Introduction and Overview of Technologies Used with GitHub Actions
  7. Chapter 1: Learning the Foundations for GitHub Actions
    1. Technical requirements
    2. Understanding the basics of CI/CD
      1. A brief trip through the history of software development
    3. Introduction to GitHub: creating a user account
      1. Creating a free user account on GitHub
      2. Creating a PAT
      3. About SSH keys
      4. Checking for existing SSH keys
      5. Adding your SSH key to your GitHub user account
    4. Discovering the basics of Git and GitHub
      1. Configuring Git
      2. Basic Git commands
      3. Basics of GitHub
      4. Pull requests
      5. Settings
      6. Branches
      7. Actions
      8. Secrets
    5. Introduction to YAML
      1. Basic rules
      2. YAML components
    6. Summary
  8. Chapter 2: Deep Diving into GitHub Actions
    1. Learning about GitHub Actions' core concepts and components
      1. Events
      2. Jobs
      3. Steps
      4. Actions
      5. Runners
    2. Understanding the basics of workflows
      1. Learning the basics of the workflow file syntax
      2. Writing and customizing workflow files
      3. Using the Actions tab to find and customize workflow templates
    3. Securing your GitHub Actions
      1. Secrets – how to create and use them
      2. Creating encrypted secrets at the repository level
      3. Creating encrypted secrets at the environment level
      4. Using encrypted secrets in a workflow
      5. Best practices for securing self-hosted runners
    4. Summary
  9. Section 2: Advanced Concepts and Hands-On Exercises to Create Actions
  10. Chapter 3: A Closer Look at Workflows
    1. Reviewing the webhook events that trigger workflows
      1. Branch or tag creation
      2. Deployment creation and deployment status
      3. Issues
      4. Issue_comment
      5. Project
      6. Pull request
      7. Pull request review
    2. Authenticating within a workflow
      1. Overview
      2. Permissions
      3. Alternative authentication methods
    3. Understanding contexts, environment variables, and expressions
      1. Contexts
      2. Expressions
    4. Managing the workflow run
      1. Visualizing a workflow run
      2. Workflow run logs
    5. Summary
  11. Chapter 4: Working with Self-Hosted Runners
    1. Technical requirements
    2. Creating a self-hosted runner
      1. Overview
      2. Architecture and operating systems supported by self-hosted runners
      3. Communication with GitHub
      4. Adding the GitHub Actions runner application to your repository
    3. Configuring a job that runs on a self-hosted runner
    4. Managing a self-hosted runner
      1. Understanding the status of self-hosted runners
      2. Reviewing logs
      3. The automatic update process
      4. Removing a self-hosted runner
    5. Summary
  12. Chapter 5: Writing Your Own Actions
    1. Technical requirements
    2. Overview
      1. Types of actions
    3. Reviewing the metadata syntax
    4. Using exit codes
      1. Adding exit codes to a JavaScript action
      2. Adding exit codes to a Docker container action
    5. Creating a JavaScript action
      1. Prerequisites
      2. Defining the action
      3. Writing the action logic
      4. Ensuring all works as expected
    6. Creating a Docker container action
      1. Prerequisites
      2. Creating a Dockerfile in your GitHub repository
      3. Defining the action
      4. Writing the action logic
      5. Ensuring all works as expected
    7. Creating a composite run steps action
      1. Prerequisites
      2. Defining the action
      3. Ensuring all works as expected
    8. Summary
  13. Chapter 6: Marketplace – Finding Existing Actions and Publishing Your Own
    1. Technical requirements
    2. Overview
    3. Finding existing actions
    4. Publishing your own actions
      1. Prerequisites
      2. Preparing and publishing your action
    5. Removing your action from GitHub Marketplace
    6. Summary
  14. Section 3: Customizing Existing Actions, Migrations, and the Future of GitHub Actions
  15. Chapter 7: Migrations
    1. Technical requirements
    2. Considerations before you migrate
    3. Migrating from Azure Pipelines
      1. Syntax differences
    4. Migrating from GitLab CI/CD
      1. Syntax differences
    5. Migrating from Jenkins
      1. Syntax differences
    6. Summary
  16. Chapter 8: Contributing to the Community and Finding Help
    1. Technical requirements
    2. Hands-on learning
    3. Interacting with the GitHub Actions community
    4. Helping to improve GitHub Actions
    5. Requesting technical support
    6. Summary
  17. Chapter 9: The Future of GitHub Actions
    1. Technical requirements
    2. Checking the GitHub roadmap
    3. Reading the GitHub blog and changelog
    4. Connecting through social media
    5. Summary
    6. Why subscribe?
  18. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Automating Workflows with GitHub Actions
  • Author(s): Priscila Heller
  • Release date: November 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781800560406