Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: add release drafter #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name-template: 'v$RESOLVED_VERSION 🚀'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'maintenance'
- title: '📚 Documentation'
labels:
- 'documentation'
- title: '⬆️ Dependencies'
collapse-after: 5
labels:
- 'dependencies'

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'feature'
patch:
labels:
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
default: patch

sort-by: 'merged_at'
sort-direction: 'descending'

exclude-labels:
- 'skip-changelog'

autolabeler:
- label: 'documentation'
files:
- '*.md'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
- label: 'dependencies'
files:
- 'package.json'
- 'yarn.lock'

template: |
## Changes in Release v$RESOLVED_VERSION

$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION

## Installation

```bash
npm install @authsignal/node
```

or

```bash
yarn add @authsignal/node
```

or
```bash
pnpm add @authsignal/node
```

or

```bash
bun add @authsignal/node
```
2 changes: 1 addition & 1 deletion .github/workflows/.release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release the Authsignal node package

on:
release:
types: [created]
types: [published]

jobs:
build:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# GitHub Workflows

This directory contains GitHub Actions workflows for the Authsignal Node SDK.

## Release Process

The release process uses two workflows:

1. **Release Drafter**: Automatically creates and updates a draft release with categorized changes based on PR labels.
2. **Release Package**: Publishes the package to npm when a release is published on GitHub.

### How to make a release

1. All PRs should be labeled appropriately with one of:
- `feature`, `enhancement`: For new features/enhancements
- `fix`, `bugfix`, `bug`: For bug fixes
- `chore`, `maintenance`: For maintenance tasks
- `documentation`: For documentation updates
- `dependencies`: For dependency updates
- `major`, `breaking`: For breaking changes
- `minor`: For minor feature additions
- `patch`: For patch-level fixes

2. The Release Drafter will automatically create a draft release with all changes categorized by these labels.

3. To publish a new release:
- Go to the "Releases" page in your GitHub repository
- Edit the draft release created by Release Drafter
- Update the release notes if needed
- Click "Publish release"
- The release workflow will automatically publish the package to npm

## Autolabeler

The Release Drafter includes an autolabeler that will automatically apply labels to PRs based on:
- Files changed (e.g., `.md` files get the `documentation` label)
- Branch names (e.g., branches with `/fix/` get the `bug` label)
- PR titles (e.g., titles containing "fix" get the `bug` label)

This helps ensure your PRs are properly categorized in release notes.

## The complete flow is as follows:
- Release Drafter creates/updates a draft release as PRs are merged
- You review the draft release and publish it when ready
- The publish action triggers the package release workflow to npm
26 changes: 26 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Drafter

on:
push:
branches:
- main
- master
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading