Skip to content

vitoraguila/github-package-example

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

GitHub Actions Workflow Tutorial

Welcome to this tutorial! In this guide, we walk through and explain the logic behind specific steps in a GitHub Actions workflow, specifically focusing on versioning and release mechanisms.

Table of Contents

Introduction

This tutorial breaks down the internal logic of two particular steps in a GitHub Actions workflow: the “Set env” and “Patch version” steps. By understanding these steps, you will gain insight into how version numbers are handled, set, and utilized to ensure consistent project versioning in the GitHub Actions CI/CD pipeline.

Set env Step Explanation

In the “Set env” step, a GitHub Action fetches the most recent release's version number and sets it as an environment variable (RELEASE_VERSION). The script uses the GitHub CLI to list the releases, extract version numbers, and format them for use in subsequent steps.

For a detailed breakdown, please refer to the Set env Step Explanation section in the main tutorial content.

Patch Version Step Explanation

The “Patch version” step in the workflow is tasked with updating the package.json file with the latest version number fetched in the “Set env” step. It then commits this change to a new branch formatted as release/v${RELEASE_VERSION}. This step is crucial for ensuring the package.json file accurately reflects the current project version.

For a detailed explanation, please refer to the Patch Version Step Explanation section in the main tutorial content.

Conclusion

Understanding the “Set env” and “Patch version” steps in a GitHub Actions workflow is crucial for successful and consistent project versioning and releasing. This tutorial provides a clear and detailed breakdown of these steps to enhance your understanding and management of GitHub Actions workflows.

Thank you for going through this tutorial, and happy coding!