Skip to content

The easiest way to version, publish and create changelogs for your JavaScript/TypeScript projects.

License

Notifications You must be signed in to change notification settings

stellasoftio/lazy-release-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Lazy Release Action

contributions welcome License: GPL v3 GitHub Tag

The easiest way to version, publish and create changelogs for your JavaScript/TypeScript projects.

If you enjoy this tool, please consider giving it a star ⭐️ on GitHub! Also if you find it useful, consider supporting my work by buying me a coffee. Your support helps me continue to improve and maintain the project.

"Buy Me A Coffee"

Table of Contents

How does it work?

see docs

diagram

📝 Setup

  1. Update pull request settings
  • Go to Settings > General > Pull Requests
    • Uncheck "Allow merge merges"
    • Check "Allow squash merges"
      • Choose "Pull request title and description" for default commit message

PR Settings

  1. Update workflow permissions
  • Go to Settings > Actions > General
    • Set "Workflow permissions" to "Read and write permissions"
    • Check "Allow GitHub Actions to create and approve pull requests"

Workflow Permissions

  1. Create workflow file .github/workflows/release.yml
name: Release

on:
  push: # For creating or updating the Release PR
    branches:
      - main
  pull_request: # For creating a release by merging in the Release PR
    types: [closed]
    branches:
      - main

permissions:
  contents: write
  packages: write
  pull-requests: write

jobs:
  release:
    if: >
      github.event.repository.fork == false &&
      (github.event_name == 'push' || 
       (github.event_name == 'pull_request' && github.event.pull_request.merged == true))
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22

      - name: Create Release PR or Release
        uses: stellasoftio/lazy-release-action@0cb4b3f3dff07aed965af41a37112abe7b1905e2 # v0.7.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

🏷️ Types

Type Description
🚀 feat A new feature
🐛 fix A bug fix
⚡️ perf A code change that improves performance
🏠 chore Routine tasks and maintenance
📚 docs Documentation changes
🎨 style CSS changes
♻️ refactor A code refactor
test Adding missing tests or correcting existing tests
📦 build Changes that affect the build system
🤖 ci Changes to CI configuration files
revert Reverts a previous commit

🔧 Customization

Inputs

Input Type Default Value Description
github-token string '' GitHub authentication token
npm-token string '' NPM authentication token
default-branch string main The repo's default branch
snapshots boolean false Whether to create snapshots
end-commit string '' The end commit reference
release-pr-title string Version Packages The title of the release PR
publish-major-tag boolean false Publishes the major tag e.g v1. This option is useful for GitHub actions. If the tag already exists the tag will be overwritten

examples

- name: Create Release PR or Publish Release
  uses: stellasoftio/lazy-release-action@0cb4b3f3dff07aed965af41a37112abe7b1905e2 # v0.7.0
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    snapshots: true

Output Params

Output Name Description
published The flag that indicates the packages have been published to npm or GitHub packages
<package-name>_version The updated version number of the package (without scope) after processing

example

- name: Create Release PR or Publish Release
  id: lazy-release
  uses: stellasoftio/lazy-release-action@0cb4b3f3dff07aed965af41a37112abe7b1905e2 # v0.7.0
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}

- name: After Publish
  if: steps.lazy-release.outputs.published == 'true'
  run: |
    echo "Run a script after packages have been published"

- name: Get new package version
  if: ${{ steps.lazy-release.outputs.my-package_version != '' }}
  run: |
    echo "Package versions: ${{ steps.lazy-release.outputs.my-package_version }}"

💡Inspiration

This project was inspired by...

  • changelogen
    • Using emojis, compare changes
  • changesets
    • Gave me ideas on how to handle versioning for monorepos + providing a status comment
    • Idea of using a release PR
  • vite
    • Adding a date to the changelog
    • Gave me the idea of how to show breaking changes in the changelog

🔗 Links

About

The easiest way to version, publish and create changelogs for your JavaScript/TypeScript projects.

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •