Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ jobs:
actions: read
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/npmjs-publish.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Prepare Release

on:
workflow_dispatch:

jobs:
tag-release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

# Run release-drafter to determine the next version
- name: Determine next version from release-drafter
id: release_drafter
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Use the output from the previous step to version the package
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Configure Git
run: |
git config user.name 'GitHub Actions'
git config user.email 'eng+github@repl.it'

- name: Bump version and create tag
run: |
# Get the tag_name output from the release-drafter step
tag="${{ steps.release_drafter.outputs.tag_name }}"

# Strip the 'v' prefix to get the bare version number
version="${tag#v}"

echo "Next version calculated by release-drafter is: $version"

# Use the calculated version with npm version
npm version "$version"
Comment thread
daweifeng-replit marked this conversation as resolved.

- name: Push changes and tags
run: git push --follow-tags
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/publish.yml
name: Build and Publish Package

on:
push:
tags:
- 'v*' # Trigger on tags like v1.0.0, v2.3.4, etc.

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
# This checks out the code at the specific tag that triggered the workflow
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies and build
run: npm ci

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_AUTH_TOKEN }}

- name: Publish GitHub Release
uses: release-drafter/release-drafter@v5
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,29 +280,24 @@ River uses an automated release process with [Release Drafter](https://github.co

### Automated Release Process (Recommended)

1. **Label your PRs** with the appropriate version bump:
1. **Merge PRs to main** - Release Drafter automatically:

- `patch` - Bug fixes, small improvements (e.g., 0.208.4 → 0.208.5)
- `minor` - New features, backwards compatible (e.g., 0.208.4 → 0.209.0)
- `major` - Breaking changes (e.g., 0.208.4 → 1.0.0)

2. **Merge PRs to main** - Release Drafter automatically:
- Updates the draft release notes with PR titles
- You can view the draft at [GitHub Releases](../../releases)

- Creates/updates a draft release with the calculated version
- Generates release notes from PR titles
- Determines version bump based on the highest label used
2. **When ready to release**:

3. **Publish the release** when ready:
- Go to [GitHub Releases](../../releases)
- Review the draft release notes
- Click "Publish release"
- This automatically publishes to NPM
- Go to [Actions](../../actions/workflows/prepare-release.yml)
- Click "Run workflow" to open the configuration dialog
- Click "Run workflow" again to confirm and start the process (version is automatically determined from draft release)

### Manual Release (Alternative)
The version bump is automatically calculated based on PR labels:

For hotfixes or special cases, you can manually trigger a release:
- `patch` - Bug fixes, small improvements (e.g., 0.208.4 → 0.208.5)
- `minor` - New features, backwards compatible (e.g., 0.208.4 → 0.209.0)
- `major` - Breaking changes (e.g., 0.208.4 → 1.0.0)

1. Go to [Actions](../../actions/workflows/npmjs-publish.yml)
2. Click "Run workflow"
3. Enter the desired version (e.g., `0.208.5`)
4. Click "Run workflow"
3. **Automation takes over**:
- The "Prepare Release" workflow bumps the version and creates a git tag
- The git tag automatically triggers the "Build and Publish" workflow
- The `river` package is published to NPM and the GitHub release is created
Loading