diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 64658b2..a67dc19 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -12,5 +12,7 @@ permissions: jobs: call-prepare: uses: leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml@develop + with: + base-branch: 'master' secrets: ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml index 3adbdc9..20231b2 100644 --- a/.github/workflows/reusable-prepare-release.yml +++ b/.github/workflows/reusable-prepare-release.yml @@ -8,6 +8,11 @@ on: required: false type: string default: '20' + base-branch: + description: 'Base branch name for release pull requests.' + required: false + type: string + default: 'master' commit-user-name: description: 'Git user name for commit' required: false @@ -27,44 +32,49 @@ jobs: prepare-release: runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: 👣 Track Workflow Run + continue-on-error: true + run: | + curl -s "https://abacus.jasoncameron.dev/hit/leoweyr/github-release-workflow-usage" > /dev/null + + - name: 📂 Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Checkout Config + - name: 🔄 Sync Changelog Config uses: actions/checkout@v4 with: repository: 'leoweyr/github-release-workflow' path: .change-log-config sparse-checkout: src/cliff.toml - - name: Setup Node.js + - name: 📦 Install Node.js uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-verions }} - - name: Set Environment Variables + - name: 🛠️ Set Environment Variables run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - name: Create Release Branch + - name: 🪾 Create Release Branch run: | git config --global user.name "${{ inputs.commit-user-name }}" git config --global user.email "${{ inputs.commit-user-email }}" git checkout -b release/${{ env.TAG_NAME }} - - name: Generate Changelog Content for PR Body + - name: 📝 Generate Changelog Content for PR Body env: GITHUB_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | npx git-cliff --config .change-log-config/src/cliff.toml --verbose --latest --strip all > pr_body_raw.md - - name: Save PR Body to File + - name: 📂 Save PR Body to File run: | cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md - - name: Update CHANGELOG.md File + - name: 📝 Update Changelog File env: GITHUB_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} @@ -77,18 +87,18 @@ jobs: npx git-cliff --config .change-log-config/src/cliff.toml --verbose --output CHANGELOG.md fi - - name: Commit and Push + - name: 🔄 Sync Commit and Push run: | git add CHANGELOG.md git commit -m "release: ${{ env.TAG_NAME }}" git push origin release/${{ env.TAG_NAME }} - - name: Create Pull Request + - name: 🚀 Deploy Pull Request env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | gh pr create \ --title "release: ${{ env.TAG_NAME }}" \ --body-file pr_body_cleaned.md \ - --base master \ + --base ${{ inputs.base-branch }} \ --head release/${{ env.TAG_NAME }} diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml index a49fb3d..1303a71 100644 --- a/.github/workflows/reusable-publish-release.yml +++ b/.github/workflows/reusable-publish-release.yml @@ -12,12 +12,17 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Code + - name: 👣 Track Workflow Run + continue-on-error: true + run: | + curl -s "https://abacus.jasoncameron.dev/hit/leoweyr/github-release-workflow-usage" > /dev/null + + - name: 📂 Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Extract Tag Name + - name: 🔍 Verify Release Tag Name id: extract_tag run: | TITLE="${{ github.event.pull_request.title }}" @@ -26,12 +31,12 @@ jobs: VERSION_TITLE=${TAG_NAME#v} echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV - - name: Create Release Body File + - name: 📝 Create Release Body File env: PR_BODY: ${{ github.event.pull_request.body }} run: echo "$PR_BODY" > release_body.md - - name: Create GitHub Release + - name: 🚀 Deploy GitHub Release env: GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | diff --git a/.github/workflows/update-used-by-repos-stats.yml b/.github/workflows/update-used-by-repos-stats.yml new file mode 100644 index 0000000..b4d1df4 --- /dev/null +++ b/.github/workflows/update-used-by-repos-stats.yml @@ -0,0 +1,60 @@ +name: Update Used by Repos Stats + +on: + push: + schedule: + - cron: "47 9 * * *" + workflow_dispatch: + +jobs: + update-dependents-stats: + runs-on: ubuntu-latest + steps: + - name: 🔍 Verify Dependent Repositories in GitHub Code + id: get-count + env: + GH_TOKEN: ${{ secrets.APP_GITHUB_TOKEN }} + run: | + set -euo pipefail + QUERIES=( + 'leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml path:.github/workflows' + 'leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml path:.github/workflows' + ) + + ALL_REPOSITORIES='' + + for QUERY in "${QUERIES[@]}"; do + echo "🔍 Searching for: $QUERY" + RESULTS=$(gh api --paginate -X GET search/code \ + -F q="$QUERY" \ + -F per_page=100 \ + --jq '.items[].repository.full_name') + + if [ -n "$RESULTS" ]; then + ALL_REPOSITORIES="$(printf '%s\n%s' "$ALL_REPOSITORIES" "$RESULTS")" + fi + + sleep 2 + done + + ALL_REPOSITORIES=$(printf '%s\n' "$ALL_REPOSITORIES" | sed '/^$/d') + + if [ -z "$ALL_REPOSITORIES" ]; then + COUNT=0 + else + COUNT=$(printf '%s\n' "$ALL_REPOSITORIES" | sort -u | wc -l | tr -d ' ') + fi + + echo "✅ Found $COUNT unique dependent repositories." + + printf 'TOTAL_COUNT=%s\n' "$COUNT" >> "$GITHUB_ENV" + + - name: 🔄 Sync Gist Badge Data + uses: schneegans/dynamic-badges-action@v1.7.0 + with: + auth: ${{ secrets.APP_GITHUB_TOKEN }} + gistID: 0575adecfc13c95f281dfccfe5b76063 + filename: github-release-workflow-used-by-stats.json + label: Used by + message: ${{ env.TOTAL_COUNT }} repos + color: "#CCA414" diff --git a/CHANGELOG.md b/CHANGELOG.md index af3270b..db3a09e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,29 @@ All notable changes to this project will be documented in this file. +# [1.0.1](https://github.com/leoweyr/github-release-workflow/compare/v1.0.0...v1.0.1) (2026-03-29) +### Bug Fixes + +* ensure revert commits follow conventional format in changelog ([dd5ada5](https://github.com/leoweyr/github-release-workflow/commit/dd5ada5e8272905e52de6406c80e15e7687b5a66)) [@leoweyr](https://github.com/leoweyr) +* prioritize revert commits parsing to prevent misclassification as fixes ([1eaef1a](https://github.com/leoweyr/github-release-workflow/commit/1eaef1a20d01fc9c1364450edf8835ec28a8cef5)) [@leoweyr](https://github.com/leoweyr) +* use type field to correctly classify revert commits in change log ([167d2d0](https://github.com/leoweyr/github-release-workflow/commit/167d2d00feabc34b87df97d9813c5b1ab7a2d27e)) [@leoweyr](https://github.com/leoweyr) +* preserve original type/scope in revert commit preprocessing ([026c69b](https://github.com/leoweyr/github-release-workflow/commit/026c69bca35934a55b410dfcb0967c04a45784b5)) [@leoweyr](https://github.com/leoweyr) +* **cliff:** classify build commits under DevOps ([5f388b2](https://github.com/leoweyr/github-release-workflow/commit/5f388b21e821991109aa423c44000d0c1636571f)) [@leoweyr](https://github.com/leoweyr) +* make release base branch configurable via reusable workflow input ([80556c5](https://github.com/leoweyr/github-release-workflow/commit/80556c58d324283358c651fee2049b8b030d62cd)) [@leoweyr](https://github.com/leoweyr) + + +### Features + +* add tracker for reusable workflow usage ([86c093b](https://github.com/leoweyr/github-release-workflow/commit/86c093b0a8ea79899530578d3a86c452cd1cdb4c)) [@leoweyr](https://github.com/leoweyr) + + +### DevOps + +* add update used by repos stats workflow ([1c00f3d](https://github.com/leoweyr/github-release-workflow/commit/1c00f3daa4c7858d75a591fe313472e561493709)) [@leoweyr](https://github.com/leoweyr) +* stabilize reusable workflow dependency search ([4c3e192](https://github.com/leoweyr/github-release-workflow/commit/4c3e1924b3628575dd60216fd88c1699834b193e)) [@leoweyr](https://github.com/leoweyr) + + + # [1.0.0] (2026-03-20) ### Bug Fixes diff --git a/README.md b/README.md index 9c376bd..6a699e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ![github-release-workflow](https://socialify.git.ci/leoweyr/github-release-workflow/image?description=1&font=KoHo&forks=1&issues=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fleoweyr%2Fgithub-release-workflow%2Frefs%2Fheads%2Fdevelop%2Fassets%2Ficon.svg&name=1&owner=1&pattern=Formal+Invitation&pulls=1&stargazers=1&theme=Light) +![Usage](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fabacus.jasoncameron.dev%2Fget%2Fleoweyr%2Fgithub-release-workflow-usage&query=%24.value&label=Usage&color=blue&suffix=%20times) +![Used by Stats](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/leoweyr/0575adecfc13c95f281dfccfe5b76063/raw/github-release-workflow-used-by-stats.json) + > [!IMPORTANT] > To ensure changelogs are generated correctly, all git commit messages must follow the **[Conventional Commits](https://www.conventionalcommits.org/)** specification. > diff --git a/src/cliff.toml b/src/cliff.toml index 976cbe6..ce34785 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -58,15 +58,18 @@ conventional_commits = true filter_unconventional = true split_commits = false commit_preprocessors = [ - { pattern = '^Revert "(.+)"$', replace = "revert $1" }, + { pattern = '^Revert "([a-z]+)(\((.+)\))?: (.+)"$', replace = "revert($1:$3): $4" }, + { pattern = '^Revert "([a-z]+): (.+)"$', replace = "revert($1): $2" }, ] commit_parsers = [ + { message = "^revert", group = "Revert" }, { message = "^fix", group = "Bug Fixes" }, { message = "^feat", group = "Features" }, { message = "^perf", group = "Performance" }, { message = "^refactor", group = "Refactor" }, { message = "^test", group = "Testing" }, + { message = "^build", group = "DevOps" }, { message = "^ci", group = "DevOps" }, { message = "^doc", group = "Documentation" }, { message = "^style", group = "Styling" }, @@ -76,7 +79,6 @@ commit_parsers = [ { message = "^chore\\(pull\\)", skip = true }, { message = "^chore", group = "Miscellaneous Tasks" }, { body = ".*security", group = "Security" }, - { message = "^[Rr]evert", group = "Revert" }, ] protect_breaking_commits = false