diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f6e9e1ab..39171d3d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -63,6 +63,42 @@ When you're ready to contribute code: --- +## Changelog Guidelines + +We use automated changelog generation based on PR labels. To ensure your changes are properly documented: + +### PR Labels for Changelog + +When creating a PR, apply one of the following labels to categorize your change: + +| Label | Use When | +|-------|----------| +| `changelog:added` | Adding new features or capabilities | +| `changelog:changed` | Modifying existing functionality | +| `changelog:fixed` | Fixing bugs or issues | +| `changelog:removed` | Removing features or capabilities | +| `changelog:security` | Addressing security vulnerabilities | +| `changelog:skip` | Changes that should not appear in changelog (CI, docs, chores) | + +### Breaking Changes + +If your PR introduces a breaking change: +1. Add the `changelog:breaking` label +2. Clearly document the breaking change in your PR description +3. Include migration instructions if applicable + +### Automatic Labeling + +Labels are automatically suggested based on PR titles: +- Titles containing "fix", "bug" → `changelog:fixed` +- Titles containing "add", "feat", "new" → `changelog:added` +- Titles containing "update", "improve", "enhance" → `changelog:changed` +- Titles starting with "chore", "ci", "docs" → `changelog:skip` + +You can override automatic labels by manually applying the correct label. + +--- + ## Testing Before submitting a PR, ensure that your changes pass all tests. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 320d9dff..d7ddda91 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -34,13 +34,14 @@ _Why is this change required? What problem does it solve?_ ## 🔍 Types of Changes -_Indicate which type of changes your code introduces (check all that apply):_ - -- [ ] **BUGFIX:** Non-breaking fix for an issue. -- [ ] **NEW FEATURE:** Non-breaking addition of functionality. -- [ ] **BREAKING CHANGE:** Fix or feature that causes existing functionality to not work as expected. -- [ ] **ENHANCEMENT:** Improvement to existing functionality. -- [ ] **CHORE:** Changes that do not affect production (e.g., documentation, build tooling, CI). +_Indicate which type of changes your code introduces (check all that apply)._ +_Please also add the corresponding `changelog:*` label to this PR._ + +- [ ] **BUGFIX:** Non-breaking fix for an issue. (Label: `changelog:fixed`) +- [ ] **NEW FEATURE:** Non-breaking addition of functionality. (Label: `changelog:added`) +- [ ] **BREAKING CHANGE:** Fix or feature that causes existing functionality to not work as expected. (Labels: `changelog:changed` + `changelog:breaking`) +- [ ] **ENHANCEMENT:** Improvement to existing functionality. (Label: `changelog:changed`) +- [ ] **CHORE:** Changes that do not affect production (e.g., documentation, build tooling, CI). (Label: `changelog:skip`) ## 🔬 QA / Verification Steps diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..ce2ede59 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,66 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## What's Changed + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION + +categories: + - title: 'Added' + labels: + - 'changelog:added' + - title: 'Changed' + labels: + - 'changelog:changed' + - title: 'Fixed' + labels: + - 'changelog:fixed' + - title: 'Removed' + labels: + - 'changelog:removed' + - title: 'Security' + labels: + - 'changelog:security' + +exclude-labels: + - 'changelog:skip' + +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' + +version-resolver: + major: + labels: + - 'changelog:breaking' + minor: + labels: + - 'changelog:added' + patch: + labels: + - 'changelog:fixed' + - 'changelog:changed' + default: patch + +autolabeler: + - label: 'changelog:fixed' + title: + - '/fix/i' + - '/bug/i' + - label: 'changelog:added' + title: + - '/add/i' + - '/feat/i' + - '/new/i' + - label: 'changelog:changed' + title: + - '/update/i' + - '/improve/i' + - '/enhance/i' + - '/bump/i' + - label: 'changelog:skip' + title: + - '/^chore/i' + - '/^ci/i' + - '/^docs/i' diff --git a/.github/workflows/create-tag-and-exit.yml b/.github/workflows/create-tag-and-exit.yml index 5c3311c5..1dd8ca82 100644 --- a/.github/workflows/create-tag-and-exit.yml +++ b/.github/workflows/create-tag-and-exit.yml @@ -1,4 +1,4 @@ -name: Tag zxporter (manual) +name: Tag and Release zxporter (manual) on: workflow_dispatch: @@ -13,6 +13,8 @@ permissions: jobs: tag: runs-on: ubuntu-latest + outputs: + new_tag: ${{ steps.create_tag.outputs.new_tag }} steps: - name: Checkout uses: actions/checkout@v4 @@ -20,6 +22,7 @@ jobs: fetch-depth: 0 - name: Create tag (user input or bump patch) + id: create_tag run: | git config user.name "github-actions" git config user.email "github-actions@github.com" @@ -35,6 +38,24 @@ jobs: fi echo "Creating new tag: $NEW_TAG" + echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT git tag $NEW_TAG git push origin $NEW_TAG + publish_release: + needs: tag + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Publish Release + uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + publish: true + tag: ${{ needs.tag.outputs.new_tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..99389d98 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,25 @@ +name: Release Drafter + +on: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled] + +permissions: + contents: read + pull-requests: write + +jobs: + update_release_draft: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 00000000..73772ba2 --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,36 @@ +name: Update Changelog + +on: + release: + types: [published] + +permissions: + contents: write + pull-requests: write + +jobs: + update-changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update CHANGELOG.md + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.tag_name }} + release-notes: ${{ github.event.release.body }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "docs: update CHANGELOG.md for ${{ github.event.release.tag_name }}" + title: "docs: update CHANGELOG.md for ${{ github.event.release.tag_name }}" + body: | + This PR updates the CHANGELOG.md with release notes for ${{ github.event.release.tag_name }}. + + Auto-generated by the Update Changelog workflow. + branch: "changelog/update-${{ github.event.release.tag_name }}" + labels: "changelog:skip" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..79ee59d7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to ZXporter will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## Historical Releases + +For releases prior to automated changelog generation, please see the +[GitHub Releases](https://github.com/devzero-inc/zxporter/releases) page. + +[Unreleased]: https://github.com/devzero-inc/zxporter/compare/v0.0.51...HEAD diff --git a/README.md b/README.md index 69b3aecb..32246e7a 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,9 @@ kubectl apply -f https://raw.githubusercontent.com//zxporter//dist/ins ## Contributing -We welcome contributions! Please see our contributing guidelines for more information. +We welcome contributions! Please see our [Contributing Guidelines](.github/CONTRIBUTING.md) for more information. + +For a history of changes, see the [CHANGELOG](CHANGELOG.md). ### Development Setup