Skip to content

Instantly share code, notes, and snippets.

@aneudy1702
Last active January 30, 2024 21:15
Show Gist options
  • Save aneudy1702/060494e9e0bc7b7305f10f336d4f45c1 to your computer and use it in GitHub Desktop.
Save aneudy1702/060494e9e0bc7b7305f10f336d4f45c1 to your computer and use it in GitHub Desktop.
Streamlining Software Releases: Combining GitHub Actions with Semantic-Release and Release-Please

DALL·E 2024-01-30 15 48 08 - A modern, digital landscape-oriented illustration symbolizing software automation and GitHub Actions, without any text  The image should convey the es

Streamlining Software Releases: Combining GitHub Actions with Semantic-Release and Release-Please

TL;DR - Summary

Discover streamlined software release processes using GitHub Actions with 'semantic-release' and 'release-please.' This guide compares these tools for different project types, offering practical insights and resources for mastering automated releases.


Understanding Semantic Versioning (SemVer) and Conventional Commits

Semantic Versioning (SemVer)

Semantic Versioning is a 3-component format (MAJOR.MINOR.PATCH) that communicates software changes. It uses significant changes for updates, minor for new features, and patches for bug fixes. Learn more about SemVer

Conventional Commits

Conventional Commits add readable meaning to commit messages, facilitating better pull request management. Learn more about Conventional Commits


Automating your Release Process via GitHub Actions

In today's fast-paced software development, efficient automation is crucial. GitHub Actions can streamline your workflow. This section delves into semantic-release and release-please, focusing on their integration with GitHub Actions.

Semantic-Release as a GitHub Action

semantic-release automates versioning and package publishing based on Semantic Versioning. Its integration with GitHub Actions offers a smooth workflow for software release, with automated version management and a customizable plugin ecosystem.

Workflow Example

name: Release
on:
  push:
    branches:
      - main
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '14'
      - run: npm install
      - run: npx semantic-release

Integration Benefits

  • Streamlined release process within GitHub.
  • Customizable for various project needs.

Release-Please and Release PRs

release-please automates release pull requests through GitHub Actions, continuously updating them with new changes.

Workflow Example

name: Release Please
on:
  push:
    branches:
      - main
jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: GoogleCloudPlatform/release-please-action@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          release-type: node
          package-name: example-package

Integration Benefits

  • PR-based workflow aligns with GitHub's collaborative features.
  • Automated tagging and release on PR merge.

Takeaway

Both tools offer unique advantages for automating releases in a GitHub-centric workflow. Choose based on your project requirements and team workflow preferences.


Semantic-Release vs Release-Please: What's different?

In software development, efficient release management is crucial. semantic-release and release-please offer different automation solutions. This section provides a detailed comparative analysis.

Commit Message Convention

  • Semantic-Release: Requires strict adherence to Conventional Commits.
  • Release-Please: More accommodating of variations, leveraging GitHub context.

Integration with GitHub

  • Semantic-Release: Integrates with GitHub but may need additional configurations.
  • Release-Please: Offers seamless GitHub integration with PR-based version management.

Versioning and Release Management

  • Semantic-Release: Highly automated for platforms like npm.
  • Release-Please: Utilizes a PR-based approach for collaborative release management.

Customization and Flexibility

  • Semantic-Release: Extensive customization with a plugin ecosystem.
  • Release-Please: Provides essential functionalities with more limited customization.

Ease of Use and Setup

  • Semantic-Release: Requires understanding of its plugin system.
  • Release-Please: Easier to set up, especially for GitHub-centric teams.

Heuristics for choosing Semantic-Release or Release-Please

Okay, so which one do I choose?

Screen Shot 2024-01-30 at 4 12 19 PM

Here is how I'd assess such a critical dilemma:

For Web Applications: Use Release-Please

Release-Please's simpler PR-based workflow and tight GitHub integration make it ideal for web applications, facilitating better review practices and team collaboration.

For Libraries: Use Semantic-Release

Semantic-Release's strict versioning control and extensive customization are crucial for libraries, ensuring compatibility and minimizing human error in versioning.


Conclusion

Select Release-Please for web applications for its simpler workflow. Choose Semantic-Release for libraries for its precise versioning and customization capabilities.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment