From 3626e13b5e61d2113375553cbf596e193ce10794 Mon Sep 17 00:00:00 2001 From: Maxime Nony Date: Sat, 18 Oct 2025 14:52:43 +0200 Subject: [PATCH 1/5] Initial commit of reusable workflows including NPM Publish and Auto Release workflows. Added configuration files for Release Please, comprehensive documentation, and a structured changelog. --- .github/release.yml | 32 ++++ .github/workflows/npm-publish.yml | 86 +++++++++ .github/workflows/release.yml | 40 ++++ .github/workflows/rws-versioning.yml | 20 ++ .release-please-manifest.json | 3 + CHANGELOG.md | 37 ++++ CONTRIBUTING.md | 179 ++++++++++++++++++ README.md | 175 ++++++++++++++++- npm-publish/README.md | 133 +++++++++++++ release-please-config.json | 26 +++ release/README.md | 273 +++++++++++++++++++++++++++ 11 files changed, 1003 insertions(+), 1 deletion(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/npm-publish.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/rws-versioning.yml create mode 100644 .release-please-manifest.json create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 npm-publish/README.md create mode 100644 release-please-config.json create mode 100644 release/README.md diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..866b2af --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,32 @@ +changelog: + exclude: + labels: + - ignore-for-release + categories: + - title: 🚀 New Workflows + labels: + - new-workflow + - workflow + - title: ✨ Enhancements + labels: + - enhancement + - feature + - title: 🐛 Bug Fixes + labels: + - bug + - fix + - title: 📚 Documentation + labels: + - documentation + - docs + - title: 🔧 Maintenance + labels: + - maintenance + - chore + - dependencies + - title: 🔐 Security + labels: + - security + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..bc61515 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..872c43c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +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' + secrets: + GITHUB_TOKEN: + description: 'GitHub token for creating releases' + required: false + +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: ${{ secrets.GITHUB_TOKEN || github.token }} diff --git a/.github/workflows/rws-versioning.yml b/.github/workflows/rws-versioning.yml new file mode 100644 index 0000000..4e7ccb7 --- /dev/null +++ b/.github/workflows/rws-versioning.yml @@ -0,0 +1,20 @@ +name: Auto Release + +on: + push: + branches: + - main + +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 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..e18ee07 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..12d45c0 --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2d17d4a --- /dev/null +++ b/CONTRIBUTING.md @@ -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 + +``` +(): + +[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! diff --git a/README.md b/README.md index 5d3ee86..1518256 100644 --- a/README.md +++ b/README.md @@ -1 +1,174 @@ -# reusable-workflows \ No newline at end of file +# Reusable Workflows + +Collection of reusable GitHub Actions workflows to automate your CI/CD tasks. + +## Available Workflows + +### 📦 NPM Publish + +Workflow to test, build, and publish NPM packages with Bun. + +**Location:** [.github/workflows/npm-publish.yml](.github/workflows/npm-publish.yml) + +**Full documentation:** [npm-publish/README.md](npm-publish/README.md) + +#### Quick Start + +```yaml +on: + release: + types: [published] + +jobs: + publish: + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + +### 🚀 Auto Release (Release Please) + +Workflow to automate your releases with Google's Release Please. Analyzes your commits and automatically creates release PRs. + +**Location:** [.github/workflows/release.yml](.github/workflows/release.yml) + +**Full documentation:** [release/README.md](release/README.md) + +#### Quick Start + +```yaml +on: + push: + branches: + - main + +jobs: + release: + uses: sendo/reusable-workflows/.github/workflows/release.yml@main + permissions: + contents: write + pull-requests: write +``` + +**Required configuration in your repo:** Create `release-please-config.json` and `.release-please-manifest.json`. See the [full documentation](release/README.md) for details. + +--- + +## Versioning This Repository + +This repository uses [Semantic Versioning](https://semver.org/) and [Conventional Commits](https://www.conventionalcommits.org/). + +### Automated Release with Release Please + +This project uses Google's [Release Please](https://github.com/googleapis/release-please) to automate releases. + +#### Commit Format + +```bash +# Feature (bumps MINOR: 1.0.0 -> 1.1.0) +feat: add new workflow for Docker builds +feat(npm): support custom registry authentication + +# Fix (bumps PATCH: 1.0.0 -> 1.0.1) +fix: correct timeout handling in release workflow +fix(release): handle missing changelog file + +# Breaking Change (bumps MAJOR: 1.0.0 -> 2.0.0) +feat!: redesign npm-publish workflow API +feat(release)!: remove deprecated artifact-path option + +# Other types (included in changelog but no version bump) +docs: update README with new examples +chore: update dependencies +refactor: simplify version normalization +``` + +#### How It Works + +On every push to `main`, Release Please: + +1. **Analyzes commits** since the last release (via Conventional Commits) +2. **Creates/updates an automated PR** with: + - The calculated new version + - Generated CHANGELOG + - All updated files +3. **When you merge the PR** → Release is automatically created with: + - Git tag + - GitHub release + - Published CHANGELOG + +#### Typical Workflow + +```bash +# 1. Development with conventional commits +git commit -m "feat: add Docker build workflow" +git commit -m "fix: correct npm token validation" +git push origin main + +# 2. Release Please automatically creates a PR "chore(main): release X.X.X" + +# 3. Review and merge the PR + +# 4. Release is created automatically! 🎉 +``` + +#### Release Please Benefits + +- ✅ **Used by Google** on all their open source projects +- ✅ **Zero configuration** - Works out of the box +- ✅ **Review PR** - You control when the release happens +- ✅ **Automatic CHANGELOG** - Generated and committed to repo +- ✅ **Maintainable** - No custom bash scripts + +### Using a Specific Version + +```yaml +jobs: + publish: + # Specific version (recommended for stability) + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@v1.0.0 + + # Latest version (to always use the latest features) + # uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main +``` + +--- + +## Usage + +Each workflow has its own detailed documentation with: + +- Input and secret configuration +- Various usage examples +- Best practices +- Setup guide + +Check the README files in each folder for more information. + +## Project Structure + +```text +reusable-workflows/ +├── .github/ +│ └── workflows/ +│ ├── npm-publish.yml # NPM publish workflow +│ └── release.yml # GitHub release workflow +├── npm-publish/ +│ └── README.md # NPM Publish documentation +├── release/ +│ └── README.md # Release documentation +└── README.md # This file +``` + +## Actions Used + +All workflows use only official and verified actions: + +- [actions/checkout@v4](https://github.com/actions/checkout) - Official GitHub action +- [oven-sh/setup-bun@v2](https://github.com/oven-sh/setup-bun) - Official Bun action +- [actions/setup-node@v4](https://github.com/actions/setup-node) - Official GitHub action +- [googleapis/release-please-action@v4](https://github.com/googleapis/release-please-action) - Google's Release Please action + +## License + +MIT \ No newline at end of file diff --git a/npm-publish/README.md b/npm-publish/README.md new file mode 100644 index 0000000..692bd72 --- /dev/null +++ b/npm-publish/README.md @@ -0,0 +1,133 @@ +# NPM Publish Workflow + +Reusable workflow to test, build, and publish NPM packages with Bun. + +## Usage + +```yaml +name: Publish to NPM + +on: + release: + types: [published] + +jobs: + publish: + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main + with: + bun-version: 'latest' + node-version: '20' + working-directory: '.' + registry-url: 'https://registry.npmjs.org' + skip-tests: false + skip-build: false + access: 'public' + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + +## Inputs + +| Input | Description | Required | Default | +|-------|-------------|----------|---------| +| `node-version` | Node.js version to use | No | `'20'` | +| `bun-version` | Bun version to use | No | `'latest'` | +| `working-directory` | Working directory for the project | No | `'.'` | +| `registry-url` | NPM registry URL | No | `'https://registry.npmjs.org'` | +| `skip-tests` | Skip running tests | No | `false` | +| `skip-build` | Skip build step | No | `false` | +| `access` | NPM package access level (public or restricted) | No | `'public'` | + +## Secrets + +| Secret | Description | Required | +|--------|-------------|----------| +| `NPM_TOKEN` | NPM authentication token | Yes | + +## NPM Token Configuration + +1. Create a token on [npmjs.com](https://www.npmjs.com/settings/YOUR_USERNAME/tokens) +2. Add the token to your GitHub repository secrets: Settings → Secrets → Actions → New repository secret +3. Name it `NPM_TOKEN` + +## Examples + +### Automatic publish on release + +```yaml +name: Publish Package + +on: + release: + types: [published] + +jobs: + publish: + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + +### Publish with custom configuration + +```yaml +name: Publish Package + +on: + workflow_dispatch: + +jobs: + publish: + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main + with: + bun-version: '1.1.0' + node-version: '22' + working-directory: './packages/my-package' + access: 'restricted' + skip-tests: false + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + +### Publish without tests or build (pre-built package) + +```yaml +name: Quick Publish + +on: + push: + tags: + - 'v*' + +jobs: + publish: + uses: sendo/reusable-workflows/.github/workflows/npm-publish.yml@main + with: + skip-tests: true + skip-build: true + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +``` + +## Workflow Steps + +1. Checkout code +2. Setup Bun with specified version +3. Install dependencies (`bun install --frozen-lockfile`) +4. Run tests (`bun test`) - unless `skip-tests: true` +5. Build package (`bun run build`) - unless `skip-build: true` +6. Setup Node.js for publishing +7. Publish to NPM with provided token + +## Permissions + +The workflow requires the following permissions: + +- `contents: read` - To read repository code +- `id-token: write` - For NPM provenance publishing + +## Notes + +- The workflow uses `--frozen-lockfile` to ensure reproducible builds +- Build uses Bun but publishing uses npm for better compatibility +- Supports custom NPM registries (GitHub Packages, private registries, etc.) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..2968168 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,26 @@ +{ + "release-type": "simple", + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "release-type": "simple", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "draft": false, + "prerelease": false + } + }, + "changelog-sections": [ + { "type": "feat", "section": "✨ Features", "hidden": false }, + { "type": "fix", "section": "🐛 Bug Fixes", "hidden": false }, + { "type": "perf", "section": "⚡ Performance Improvements", "hidden": false }, + { "type": "revert", "section": "⏪ Reverts", "hidden": false }, + { "type": "docs", "section": "📚 Documentation", "hidden": false }, + { "type": "style", "section": "💎 Styles", "hidden": true }, + { "type": "chore", "section": "🔧 Miscellaneous", "hidden": false }, + { "type": "refactor", "section": "♻️ Code Refactoring", "hidden": false }, + { "type": "test", "section": "✅ Tests", "hidden": true }, + { "type": "build", "section": "📦 Build System", "hidden": true }, + { "type": "ci", "section": "👷 Continuous Integration", "hidden": true } + ] +} diff --git a/release/README.md b/release/README.md new file mode 100644 index 0000000..1582df8 --- /dev/null +++ b/release/README.md @@ -0,0 +1,273 @@ +# Auto Release Workflow with Release Please + +Reusable workflow pour automatiser vos releases avec **Release Please** de Google. + +## Qu'est-ce que Release Please ? + +Release Please automatise complètement les releases en analysant vos commits (Conventional Commits) : + +1. À chaque push sur `main`, il analyse les commits +2. Calcule la nouvelle version (MAJOR.MINOR.PATCH) +3. Crée/met à jour une PR automatique avec : + - La nouvelle version + - Le CHANGELOG généré + - Tous les fichiers mis à jour +4. Quand vous mergez la PR → Tag + Release créés automatiquement + +## Setup dans votre Repository + +### 1. Créer le workflow + +Créez `.github/workflows/release.yml` dans votre repo : + +```yaml +name: Auto Release + +on: + push: + branches: + - main # ou master + +jobs: + release: + uses: sendo/reusable-workflows/.github/workflows/release.yml@main + permissions: + contents: write + pull-requests: write +``` + +### 2. Créer les fichiers de configuration + +#### `release-please-config.json` (à la racine) + +```json +{ + "release-type": "simple", + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "release-type": "simple", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "draft": false, + "prerelease": false + } + }, + "changelog-sections": [ + { "type": "feat", "section": "✨ Features", "hidden": false }, + { "type": "fix", "section": "🐛 Bug Fixes", "hidden": false }, + { "type": "perf", "section": "⚡ Performance Improvements", "hidden": false }, + { "type": "revert", "section": "⏪ Reverts", "hidden": false }, + { "type": "docs", "section": "📚 Documentation", "hidden": false }, + { "type": "style", "section": "💎 Styles", "hidden": true }, + { "type": "chore", "section": "🔧 Miscellaneous", "hidden": false }, + { "type": "refactor", "section": "♻️ Code Refactoring", "hidden": false }, + { "type": "test", "section": "✅ Tests", "hidden": true }, + { "type": "build", "section": "📦 Build System", "hidden": true }, + { "type": "ci", "section": "👷 Continuous Integration", "hidden": true } + ] +} +``` + +#### `.release-please-manifest.json` (à la racine) + +```json +{ + ".": "0.0.0" +} +``` + +### 3. Utiliser Conventional Commits + +Vos commits doivent suivre le format Conventional Commits : + +```bash +# Feature (MINOR bump: 1.0.0 -> 1.1.0) +feat: add user authentication +feat(api): add new endpoint for payments + +# Fix (PATCH bump: 1.0.0 -> 1.0.1) +fix: correct validation error +fix(ui): fix button alignment + +# Breaking Change (MAJOR bump: 1.0.0 -> 2.0.0) +feat!: redesign API structure +fix(api)!: remove deprecated endpoint + +# Autres (inclus dans changelog mais pas de bump) +docs: update README +chore: update dependencies +``` + +## Inputs + +| Input | Description | Required | Default | +|-------|-------------|----------|---------| +| `release-type` | Type de release (simple, node, python, rust, etc.) | Non | `'simple'` | +| `config-file` | Chemin vers le fichier de config | Non | `'release-please-config.json'` | +| `manifest-file` | Chemin vers le fichier manifest | Non | `'.release-please-manifest.json'` | + +## Secrets + +| Secret | Description | Required | +|--------|-------------|----------| +| `GITHUB_TOKEN` | Token GitHub (fourni automatiquement) | Non | + +## Release Types + +Release Please supporte différents types de projets : + +- **`simple`** - Projets génériques (recommandé pour les workflows) +- **`node`** - Projets Node.js (met à jour package.json) +- **`python`** - Projets Python (met à jour setup.py, pyproject.toml) +- **`rust`** - Projets Rust (met à jour Cargo.toml) +- **`go`** - Projets Go +- Et beaucoup d'autres... + +## Exemples + +### Configuration Basique (Simple) + +```yaml +name: Auto Release + +on: + push: + branches: + - main + +jobs: + release: + uses: sendo/reusable-workflows/.github/workflows/release.yml@main + permissions: + contents: write + pull-requests: write +``` + +### Configuration pour Node.js + +```yaml +name: Auto Release + +on: + push: + branches: + - main + +jobs: + release: + uses: sendo/reusable-workflows/.github/workflows/release.yml@main + with: + release-type: node # Met à jour automatiquement package.json + permissions: + contents: write + pull-requests: write +``` + +### Configuration avec fichiers personnalisés + +```yaml +name: Auto Release + +on: + push: + branches: + - main + +jobs: + release: + uses: sendo/reusable-workflows/.github/workflows/release.yml@main + with: + config-file: .github/release-please-config.json + manifest-file: .github/.release-please-manifest.json + permissions: + contents: write + pull-requests: write +``` + +## Workflow Typique + +1. **Développement avec Conventional Commits** + ```bash + git commit -m "feat: add new feature" + git commit -m "fix: correct bug" + git push origin main + ``` + +2. **Release Please crée une PR automatiquement** + - Titre : "chore(main): release 1.1.0" + - Contient le CHANGELOG mis à jour + - Contient la nouvelle version + +3. **Review et merge de la PR** + - Vérifiez le CHANGELOG + - Mergez la PR quand prêt + +4. **Release créée automatiquement !** + - Tag git créé (ex: v1.1.0) + - Release GitHub publiée + - CHANGELOG commité dans le repo + +## Configuration Avancée + +### Monorepo + +Pour les monorepos, configurez plusieurs packages dans `release-please-config.json` : + +```json +{ + "packages": { + "packages/frontend": { + "release-type": "node", + "package-name": "@myorg/frontend" + }, + "packages/backend": { + "release-type": "node", + "package-name": "@myorg/backend" + } + } +} +``` + +### Personnaliser les sections du changelog + +Modifiez `changelog-sections` dans `release-please-config.json` : + +```json +{ + "changelog-sections": [ + { "type": "feat", "section": "🚀 New Features" }, + { "type": "fix", "section": "🐛 Bug Fixes" }, + { "type": "docs", "section": "📝 Documentation", "hidden": false } + ] +} +``` + +## Avantages + +- ✅ **Utilisé par Google** sur tous leurs projets open source +- ✅ **Zero maintenance** - Pas de scripts bash à maintenir +- ✅ **Contrôle total** - Vous décidez quand publier via la PR +- ✅ **CHANGELOG versionné** - Commité dans le repo +- ✅ **Support monorepo** - Gère plusieurs packages +- ✅ **Flexible** - Support de nombreux langages/frameworks + +## Troubleshooting + +### La PR n'est pas créée + +- Vérifiez que vos commits utilisent Conventional Commits (`feat:`, `fix:`, etc.) +- Vérifiez les permissions du workflow (`contents: write`, `pull-requests: write`) +- Vérifiez que les fichiers de config existent et sont valides + +### La release n'est pas créée après merge + +- Assurez-vous de merger la PR (pas de squash ou rebase) +- Vérifiez les permissions `contents: write` +- Consultez les logs du workflow + +## Documentation + +- [Release Please GitHub](https://github.com/googleapis/release-please) +- [Conventional Commits](https://www.conventionalcommits.org/) +- [Semantic Versioning](https://semver.org/) From f9f81aa34773a0f1faf983708f8e171ece90eb70 Mon Sep 17 00:00:00 2001 From: Maxime Nony Date: Sat, 18 Oct 2025 15:07:05 +0200 Subject: [PATCH 2/5] Remove obsolete release configuration file from GitHub workflows. --- .github/release.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index 866b2af..0000000 --- a/.github/release.yml +++ /dev/null @@ -1,32 +0,0 @@ -changelog: - exclude: - labels: - - ignore-for-release - categories: - - title: 🚀 New Workflows - labels: - - new-workflow - - workflow - - title: ✨ Enhancements - labels: - - enhancement - - feature - - title: 🐛 Bug Fixes - labels: - - bug - - fix - - title: 📚 Documentation - labels: - - documentation - - docs - - title: 🔧 Maintenance - labels: - - maintenance - - chore - - dependencies - - title: 🔐 Security - labels: - - security - - title: Other Changes - labels: - - "*" From 4429fec2db1be6cf40331ed7b702cd1df8765356 Mon Sep 17 00:00:00 2001 From: Maxime Nony Date: Sun, 19 Oct 2025 13:56:04 +0200 Subject: [PATCH 3/5] Allow versioning workflow to trigger on feat/wip branch --- .github/workflows/rws-versioning.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rws-versioning.yml b/.github/workflows/rws-versioning.yml index 4e7ccb7..c42e2c8 100644 --- a/.github/workflows/rws-versioning.yml +++ b/.github/workflows/rws-versioning.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - feat/wip permissions: contents: write From 349e3e645dc34ee9ed9e2fd1f1b8a7dde69278e0 Mon Sep 17 00:00:00 2001 From: Maxime Nony Date: Sun, 19 Oct 2025 13:58:58 +0200 Subject: [PATCH 4/5] Remove unused GitHub token secret from release workflow configuration --- .github/workflows/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 872c43c..6c228f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,10 +18,6 @@ on: required: false type: string default: '.release-please-manifest.json' - secrets: - GITHUB_TOKEN: - description: 'GitHub token for creating releases' - required: false jobs: release-please: From 55a25a45a4addf24e01d506d1e41e7066fed68f5 Mon Sep 17 00:00:00 2001 From: Maxime Nony Date: Sun, 19 Oct 2025 13:59:07 +0200 Subject: [PATCH 5/5] Update release workflow to use GitHub token directly instead of secret --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c228f0..85b92b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,4 +33,4 @@ jobs: release-type: ${{ inputs.release-type }} config-file: ${{ inputs.config-file }} manifest-file: ${{ inputs.manifest-file }} - token: ${{ secrets.GITHUB_TOKEN || github.token }} + token: ${{ github.token }}