From b1d755a36fe0b95ca8f8001ac534815e27f4e5b6 Mon Sep 17 00:00:00 2001 From: Bugs5382 Date: Thu, 4 Jun 2026 08:15:21 -0400 Subject: [PATCH] ci: add Release Drafter and CHANGELOG tracking --- .github/release-drafter.yml | 71 ++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 77 +++++++++++++++++++++++++++ CHANGELOG.md | 6 +++ 3 files changed, 154 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 CHANGELOG.md diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..bfe05e8 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,71 @@ +# Release Drafter configuration. +# +# Categories are keyed on this project's type labels (enhancement / bug / +# chore / documentation); the autolabeler classifies Conventional-Commit PR +# titles into them so the draft is categorized without manual labelling. +# +# Scope labels (phase-1/2/3, scaffolding) are deliberately NOT category or +# exclude labels — they are ignored by the changelog. Listing them under +# exclude-labels would drop nearly every PR; they simply don't drive a +# category. +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +template: | + # What Changed 👀 + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION +categories: + - title: 🚀 Features + labels: + - enhancement + - title: 🐛 Bug Fixes + labels: + - bug + - title: 📄 Documentation + labels: + - documentation + - title: 🔧 Maintenance + labels: + - chore + - title: 🧩 Dependency Updates + labels: + - dependencies + collapse-after: 5 +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' +version-resolver: + major: + labels: + - breaking + minor: + labels: + - enhancement + patch: + labels: + - bug + - chore + - documentation + - dependencies + default: patch +exclude-labels: + - skip-changelog +# Classify Conventional-Commit PR titles into the type labels above. The +# breaking rule matches the CC "!" marker (e.g. feat!: / fix(x)!:). +autolabeler: + - label: breaking + title: + - '/^[a-z]+(\(.+\))?!:/i' + - label: enhancement + title: + - '/^feat(\(.+\))?!?:/i' + - label: bug + title: + - '/^fix(\(.+\))?!?:/i' + - label: documentation + title: + - '/^docs(\(.+\))?!?:/i' + - label: chore + title: + - '/^(chore|build|ci|refactor|perf|test|style|revert)(\(.+\))?!?:/i' diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..bfebec8 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,77 @@ +name: Release Drafter + +# Drafts the next release on push to main and updates CHANGELOG.md before the +# release is cut; autolabels PRs so the draft is categorized. +# +# DISABLED until the org GitHub App is configured: every job is gated on +# `vars.APP_CLIENT_ID`, so until that variable is set the job is skipped (no +# runs, no failures). Once APP_CLIENT_ID (variable) and APP_PRIVATE_KEY +# (secret) are set for the org/repo, it self-enables — no edit required. +# +# The App token is used to push the CHANGELOG commit back to main. That commit +# touches only CHANGELOG.md (path-ignored by ci-go/ci-image) and carries +# [skip ci], so it never triggers the image build or re-triggers this workflow. + +on: + push: + branches: [main] + pull_request: + types: [opened, reopened, synchronize] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + draft: + name: Draft release and update changelog + # Inert until the GitHub App is configured (see header). + if: ${{ vars.APP_CLIENT_ID != '' }} + runs-on: ubuntu-latest + permissions: + contents: write # update releases + push the changelog commit + pull-requests: write # autolabeler + steps: + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v3.1.1 + with: + client-id: ${{ vars.APP_CLIENT_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + fetch-depth: 0 + + - name: Release Drafter + id: drafter + uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + + - name: Update CHANGELOG + if: github.event_name != 'pull_request' + uses: Bugs5382/changelog-updater-action@v0.3.2 + env: + LOG_LEVEL: debug + LOG_FORMAT: text + RELEASE_NOTES: >- + ${{ steps.drafter.outputs.body }} + RELEASE_VERSION: v${{ steps.drafter.outputs.resolved_version }} + with: + tag: ${{ env.RELEASE_VERSION }} + notes: ${{ env.RELEASE_NOTES }} + diff: "true" + + - name: Commit changelog + if: github.event_name != 'pull_request' + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "chore(pre-release): v${{ steps.drafter.outputs.resolved_version }} [skip ci]" + file_pattern: CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..90cf6f4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +All notable changes to this project are 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).