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
86 changes: 86 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: NPM Publish

on:
workflow_call:
inputs:
node-version:
description: 'Node.js version to use'
required: false
type: string
default: '20'
bun-version:
description: 'Bun version to use'
required: false
type: string
default: 'latest'
working-directory:
description: 'Working directory for the project'
required: false
type: string
default: '.'
registry-url:
description: 'NPM registry URL'
required: false
type: string
default: 'https://registry.npmjs.org'
skip-tests:
description: 'Skip running tests'
required: false
type: boolean
default: false
skip-build:
description: 'Skip running build'
required: false
type: boolean
default: false
access:
description: 'NPM package access level (public or restricted)'
required: false
type: string
default: 'public'
secrets:
NPM_TOKEN:
description: 'NPM authentication token'
required: true

jobs:
test-build-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ inputs.bun-version }}

- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: bun install --frozen-lockfile

- name: Run tests
if: ${{ !inputs.skip-tests }}
working-directory: ${{ inputs.working-directory }}
run: bun test

- name: Build package
if: ${{ !inputs.skip-build }}
working-directory: ${{ inputs.working-directory }}
run: bun run build

- name: Setup Node.js for publishing
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}

- name: Publish to NPM
working-directory: ${{ inputs.working-directory }}
run: npm publish --access ${{ inputs.access }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Release with Release Please

on:
workflow_call:
inputs:
release-type:
description: 'Release type (node, python, rust, simple, etc.)'
required: false
type: string
default: 'simple'
config-file:
description: 'Path to release-please config file'
required: false
type: string
default: 'release-please-config.json'
manifest-file:
description: 'Path to release-please manifest file'
required: false
type: string
default: '.release-please-manifest.json'

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

steps:
- name: Release Please
uses: googleapis/release-please-action@v4
with:
release-type: ${{ inputs.release-type }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
token: ${{ github.token }}
21 changes: 21 additions & 0 deletions .github/workflows/rws-versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Auto Release

on:
push:
branches:
- main
- feat/wip

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release Please
uses: googleapis/release-please-action@v4
with:
# Type de projet (pour le format de versioning)
release-type: simple
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- NPM Publish workflow (formerly bun-test-build-publish)
- Auto Release workflow using Google's Release Please
- Comprehensive documentation for each workflow
- Organized folder structure with dedicated READMEs
- Release Please integration for automated versioning
- Contributing guide with Conventional Commits

### Changed

- Renamed `bun-test-build-publish.yml` to `npm-publish.yml`
- Transformed `release.yml` to use Release Please instead of manual releases
- Improved README structure and organization
- All documentation translated to English

### Removed

- Removed `.versionrc.json` (replaced by Release Please)
- Removed `.github/commitlint.config.js` (not needed with Release Please)

## [1.0.0] - 2025-10-18

### Added

- Initial release with NPM Publish workflow
- Support for Bun-based projects
- Automated testing, building, and publishing to NPM
179 changes: 179 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Contributing Guide

Thank you for contributing to Reusable Workflows! This guide will help you follow the project's best practices.

## Conventional Commits

This project uses [Conventional Commits](https://www.conventionalcommits.org/) to automatically generate versions and changelogs.

### Format

```
<type>(<scope>): <description>

[optional body]

[optional footer(s)]
```

### Types

- **feat**: New feature (bumps MINOR)
- **fix**: Bug fix (bumps PATCH)
- **docs**: Documentation only changes
- **style**: Formatting, missing semicolons, etc.
- **refactor**: Code refactoring
- **perf**: Performance improvements
- **test**: Adding tests
- **chore**: Maintenance, dependency updates
- **ci**: CI/CD workflow changes
- **revert**: Reverts a previous commit

### Scopes (optional)

- `npm`: npm-publish workflow
- `release`: release workflow
- `docs`: Documentation
- `ci`: CI/CD configuration

### Breaking Changes

To indicate a breaking change (bumps MAJOR):

```bash
# With !
feat!: redesign workflow API

# Or with footer
feat: add new feature

BREAKING CHANGE: this changes the API signature
```

### Examples

```bash
# Feature
feat(npm): add support for custom registry authentication
feat: add Docker build workflow

# Fix
fix(release): handle missing changelog file
fix: correct timeout in npm-publish workflow

# Breaking change
feat(npm)!: redesign input parameters
refactor!: remove deprecated workflow options

# Documentation
docs: update README with new examples
docs(release): add troubleshooting section

# Maintenance
chore: update GitHub Actions to v4
chore(deps): bump softprops/action-gh-release to v2
```

## Development Workflow

1. **Create a branch** for your feature/fix
```bash
git checkout -b feat/my-new-feature
# or
git checkout -b fix/bug-description
```

2. **Make commits** following Conventional Commits
```bash
git commit -m "feat(npm): add custom registry support"
```

3. **Push and create a PR**
```bash
git push origin feat/my-new-feature
```

4. **Merge to main** → Release Please creates an automated PR
- A PR "chore(main): release X.X.X" will be created/updated
- It contains the CHANGELOG and new version
- Review and merge this PR to publish the release

## Automated Versioning with Release Please

### How It Works

This project uses Google's [Release Please](https://github.com/googleapis/release-please):

**On every push to `main`:**

1. Release Please analyzes commits since the last release
2. Calculates the new version (MAJOR.MINOR.PATCH)
3. Creates/updates an automated PR with:
- The new version
- Generated CHANGELOG
- All updated files

**When you merge the release PR:**

1. Git tag is created automatically
2. GitHub release is published
3. CHANGELOG is committed to the repo

### Versioning Rules

| Commit Type | Example | Result |
|-------------|---------|--------|
| Breaking change | `feat!:` or `BREAKING CHANGE:` | 1.0.0 → **2.0.0** |
| Feature | `feat:` | 1.0.0 → **1.1.0** |
| Fix | `fix:` | 1.0.0 → **1.0.1** |
| Others | `docs:`, `chore:`, etc. | No release |

### Example Scenarios

#### Scenario 1: Multiple features

```bash
git commit -m "feat: add Docker workflow"
git commit -m "feat(npm): support monorepos"
git commit -m "docs: update README"
git push origin main
# Result: PR "chore(main): release 1.1.0" created automatically
```

#### Scenario 2: Fix only

```bash
git commit -m "fix: correct tag validation"
git push origin main
# Result: PR "chore(main): release 1.0.1" created automatically
```

#### Scenario 3: Breaking change

```bash
git commit -m "feat!: redesign all workflow inputs"
git push origin main
# Result: PR "chore(main): release 2.0.0" created automatically
```

#### Scenario 4: Publishing the release

```bash
# Merge the PR created by Release Please
# → Tag v1.1.0 created
# → GitHub release published
# → CHANGELOG updated in the repo
```

## Tests

Before submitting a PR, ensure that:

- [ ] Your commits follow Conventional Commits
- [ ] Documentation is up to date
- [ ] Workflows are tested (if applicable)
- [ ] README contains usage examples

## Questions?

Feel free to open an issue for any questions!
Loading