Lädt...

🔧 Automate changelog generation and publish with Changesets


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Often, while working with packages, managing changelogs and versioning manually can be tedious, especially in fast-moving projects. Keeping track of what changed, bumping versions correctly, and ensuring a smooth release process requires discipline and consistency.

Changesets is a robust tool designed to streamline the entire process, from making changes and version bumps to generating changelogs and publishing the package npm.

Read more about the problem and what changesets solve here: https://github.com/changesets/changesets/blob/main/docs/detailed-explanation.md

In this article, we’ll explore how to integrate Changesets into your project.

In our workflow, we use npm to publish packages and leverage Changesets GitHub Action to automate the entire process. This ensures that every release is handled efficiently, with minimal manual intervention.

Setup

To set up changesets. Install the package and initialize

npm i -D @changesets/cli && npx changeset init

This will create a .changeset directory with a config.json, which maintains the configuration. This is also the directory where the changelog entries are stored before they are applied.

Generate changesets

Changesets are markdown files with YAML front matter, which contains the summary of the changes made and the kind of versioning. A changeset can be generated by running

npx changeset

This will prompt you to enter

  • kind of change (patch/minor/major)
  • Summary of the change

Once entered, a changeset with a unique name is generated into the .changeset directory. This file needs to be committed.

Automate releases

The process of automating changelog generation and publishing the packages to registry is handled with changesets action

Copy the following YAML to the .github/workflows/release.yaml

name: Release

on:
  push:
    branches:
      - main

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
  NODE_VERSION: 22

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      id-token: write
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v4

      - name: Setup Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Install Dependencies
        run: npm ci

      - name: Create Release Pull Request or Publish to npm
        id: changesets
        uses: changesets/action@v1
        with:
          publish: npx changeset publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Now when you push the commit with changesets to the main branch. The action will run, and depending on the changesets created, a PR with a changelog and version bump like in the following screenshot will be created.

PR Preview

When you merge this, Version Packages PR, the changeset action will again run, but this time it will publish the version bump to the package registry.

Yup, that's it, your package should be published to npm 🎉.

...

🔧 Automate changelog generation and publish with Changesets


📈 74.77 Punkte
🔧 Programmierung

🔧 Auto publish NPM packages using changesets and GitHub Actions


📈 42.33 Punkte
🔧 Programmierung

🔧 Manage your versioning and changelogs using Changesets


📈 29.1 Punkte
🔧 Programmierung

🔧 Exploring OSM changesets via DuckDB


📈 27.97 Punkte
🔧 Programmierung

🔧 @manypkg/get-packages usage in Changesets


📈 27.97 Punkte
🔧 Programmierung

🔧 Node.js util module usage in Changesets


📈 27.97 Punkte
🔧 Programmierung

🔧 Logger package in changesets monorepo


📈 27.97 Punkte
🔧 Programmierung

🔧 ExtendableError usage in changesets errors package


📈 27.97 Punkte
🔧 Programmierung

🔧 Automate Update Your Changelog with GitHub Actions


📈 26.17 Punkte
🔧 Programmierung

🔧 How to Automate Your Docker Workflow & Publish Images to GitHub Container Registry


📈 23.41 Punkte
🔧 Programmierung

🔧 Power Automate and React Integration: Automate Business Processes


📈 21.49 Punkte
🔧 Programmierung

🔧 Power Automate and React Integration: Automate Business Processes


📈 21.49 Punkte
🔧 Programmierung

🪟 You can now use the Automate tab in Excel for Windows and Mac to automate tasks


📈 21.49 Punkte
🪟 Windows Tipps

📰 Download Power Automate Desktop for Windows 10 to automate tasks and processes at no additional cost


📈 21.49 Punkte
📰 IT Nachrichten

🔧 Power Automate: Automate your life pt.2


📈 20.36 Punkte
🔧 Programmierung

🔧 Power Automate: Automate your life pt.1


📈 20.36 Punkte
🔧 Programmierung

🔧 Streamline Your Day: How to Automate Workflows with Microsoft Power Automate


📈 20.36 Punkte
🔧 Programmierung

🔧 If you could automate one process what would you automate?


📈 20.36 Punkte
🔧 Programmierung

🔧 Automate every Industry using Power Automate with Roma Gupta | #LessCodeMorePower


📈 20.36 Punkte
🔧 Programmierung

🔧 How to Automate Content Generation with Patterns, Prompts, Astro, and GitHub Actions


📈 17.58 Punkte
🔧 Programmierung

🔧 Automate Legal Contract Generation with Streamlit and Lyzr Automata


📈 17.58 Punkte
🔧 Programmierung

🔧 Changelog #0022 — 🪄 HTTPie AI assistant, methods in tabs, and more


📈 17.12 Punkte
🔧 Programmierung

🔧 Changelog #0021 — 📯 Advanced import, GraphQL schema support, and more


📈 17.12 Punkte
🔧 Programmierung

📰 CISA and US and International Partners Publish Guidance for OT Owners and Operators


📈 16.61 Punkte
📰 IT Security Nachrichten

📰 CISA and US and International Partners Publish Guidance for OT Owners and Operators


📈 16.61 Punkte
📰 IT Security Nachrichten

🔧 Automate Like a Pro: Mastering Component Generation in React with Generate React CLI


📈 16.45 Punkte
🔧 Programmierung

🔧 How to Automate Test Generation with AI: Using CodiumAI Cover-Agent


📈 16.45 Punkte
🔧 Programmierung

🐧 Automate quote generation when you open a new Linux terminal


📈 16.45 Punkte
🐧 Linux Tipps

🔧 Using Data to Automate Knowledge Generation || Ella Bor


📈 16.45 Punkte
🔧 Programmierung