From 4bec90f7d44eda66efce0e48bec8079a5c98430c Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 12:31:25 +0800 Subject: [PATCH 01/24] feat: add prepare release workflow --- .github/workflows/prepare-release.yml | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..afc7a9c --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,94 @@ +name: Prepare Release + +on: + workflow_call: + inputs: + node-verions: + description: 'Node.js version to use.' + required: false + type: string + default: '20' + commit-user-name: + description: 'Git user name for commit' + required: false + type: string + default: 'github-actions[bot]' + commit-user-email: + description: 'Git user email for commit.' + required: false + type: string + default: 'github-actions[bot]@users.noreply.github.com' + secrets: + GITHUB_TOKEN: + required: true + description: 'GitHub Token for authentication.' + +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Checkout Config + uses: actions/checkout@v4 + with: + repository: 'leoweyr/github-release-workflow' + path: .change-log-config + sparse-checkout: cliff.toml + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-verions }} + + - name: Set Environment Variables + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - 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 + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md + + - name: Save PR Body to File + run: | + cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md + + - name: Update CHANGELOG.md File + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -f "CHANGELOG.md" ]; then + # File exists: Prepend new changes (git-cliff intelligently handles headers). + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md + else + # File missing: Create new with full history and header. + npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md + fi + + - name: 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --title "release: ${{ env.TAG_NAME }}" \ + --body-file pr_body_cleaned.md \ + --base master \ + --head release/${{ env.TAG_NAME }} From 20daca810acd33ee6071d7e5668fca95e203e797 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 12:48:02 +0800 Subject: [PATCH 02/24] feat: add publish release workflow --- .github/workflows/publish-release.yml | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..6a150e0 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,41 @@ +name: Publish Release + +on: + workflow_call: + secrets: + GITHUB_TOKEN: + required: true + +jobs: + publish-release: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'release:') + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract Tag Name + id: extract_tag + run: | + TITLE="${{ github.event.pull_request.title }}" + TAG_NAME=$(echo "$TITLE" | sed 's/release: //') + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + VERSION_TITLE=${TAG_NAME#v} + echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV + + - name: Create Release Body File + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: echo "$PR_BODY" > release_body.md + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ env.TAG_NAME }} \ + --title "${{ env.VERSION_TITLE }}" \ + --notes-file release_body.md \ + --verify-tag From 047bf996a00bb3fae423b17cb3d31a9392184b65 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 13:59:08 +0800 Subject: [PATCH 03/24] feat: add user-facing workflows --- .github/workflows/prepare-release.yml | 99 +++------------------------ .github/workflows/publish-release.yml | 44 +++--------- 2 files changed, 18 insertions(+), 125 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index afc7a9c..e644bc6 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -1,94 +1,15 @@ name: Prepare Release on: - workflow_call: - inputs: - node-verions: - description: 'Node.js version to use.' - required: false - type: string - default: '20' - commit-user-name: - description: 'Git user name for commit' - required: false - type: string - default: 'github-actions[bot]' - commit-user-email: - description: 'Git user email for commit.' - required: false - type: string - default: 'github-actions[bot]@users.noreply.github.com' - secrets: - GITHUB_TOKEN: - required: true - description: 'GitHub Token for authentication.' + push: + tags: + - 'v*' -jobs: - prepare-release: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Checkout Config - uses: actions/checkout@v4 - with: - repository: 'leoweyr/github-release-workflow' - path: .change-log-config - sparse-checkout: cliff.toml - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-verions }} - - - name: Set Environment Variables - run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - 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 }} +permissions: + contents: write + pull-requests: write - - name: Generate Changelog Content for PR Body - env: - GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md - - - name: Save PR Body to File - run: | - cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md - - - name: Update CHANGELOG.md File - env: - GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ -f "CHANGELOG.md" ]; then - # File exists: Prepend new changes (git-cliff intelligently handles headers). - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md - else - # File missing: Create new with full history and header. - npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md - fi - - - name: 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 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr create \ - --title "release: ${{ env.TAG_NAME }}" \ - --body-file pr_body_cleaned.md \ - --base master \ - --head release/${{ env.TAG_NAME }} +jobs: + call-prepare: + uses: leoweyr/github-release-workflow/src/reusable-prepare-release.yml@master + secrets: inherit diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6a150e0..3a5817a 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,41 +1,13 @@ name: Publish Release on: - workflow_call: - secrets: - GITHUB_TOKEN: - required: true + pull_request: + types: [closed] -jobs: - publish-release: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'release:') - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Extract Tag Name - id: extract_tag - run: | - TITLE="${{ github.event.pull_request.title }}" - TAG_NAME=$(echo "$TITLE" | sed 's/release: //') - echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV - VERSION_TITLE=${TAG_NAME#v} - echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV +permissions: + contents: write - - name: Create Release Body File - env: - PR_BODY: ${{ github.event.pull_request.body }} - run: echo "$PR_BODY" > release_body.md - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create ${{ env.TAG_NAME }} \ - --title "${{ env.VERSION_TITLE }}" \ - --notes-file release_body.md \ - --verify-tag +jobs: + call-publish: + uses: leoweyr/github-release-workflow/src/reusable-publish-release.yml@master + secrets: inherit From e48851ca6f5f92f075fae900cfc1332b7a507a20 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 14:01:15 +0800 Subject: [PATCH 04/24] chore: move reusable workflows to src --- src/reusable-prepare-release.yml | 94 ++++++++++++++++++++++++++++++++ src/reusable-publish-release.yml | 41 ++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 src/reusable-prepare-release.yml create mode 100644 src/reusable-publish-release.yml diff --git a/src/reusable-prepare-release.yml b/src/reusable-prepare-release.yml new file mode 100644 index 0000000..afc7a9c --- /dev/null +++ b/src/reusable-prepare-release.yml @@ -0,0 +1,94 @@ +name: Prepare Release + +on: + workflow_call: + inputs: + node-verions: + description: 'Node.js version to use.' + required: false + type: string + default: '20' + commit-user-name: + description: 'Git user name for commit' + required: false + type: string + default: 'github-actions[bot]' + commit-user-email: + description: 'Git user email for commit.' + required: false + type: string + default: 'github-actions[bot]@users.noreply.github.com' + secrets: + GITHUB_TOKEN: + required: true + description: 'GitHub Token for authentication.' + +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Checkout Config + uses: actions/checkout@v4 + with: + repository: 'leoweyr/github-release-workflow' + path: .change-log-config + sparse-checkout: cliff.toml + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-verions }} + + - name: Set Environment Variables + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - 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 + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md + + - name: Save PR Body to File + run: | + cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md + + - name: Update CHANGELOG.md File + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -f "CHANGELOG.md" ]; then + # File exists: Prepend new changes (git-cliff intelligently handles headers). + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md + else + # File missing: Create new with full history and header. + npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md + fi + + - name: 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --title "release: ${{ env.TAG_NAME }}" \ + --body-file pr_body_cleaned.md \ + --base master \ + --head release/${{ env.TAG_NAME }} diff --git a/src/reusable-publish-release.yml b/src/reusable-publish-release.yml new file mode 100644 index 0000000..6a150e0 --- /dev/null +++ b/src/reusable-publish-release.yml @@ -0,0 +1,41 @@ +name: Publish Release + +on: + workflow_call: + secrets: + GITHUB_TOKEN: + required: true + +jobs: + publish-release: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'release:') + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract Tag Name + id: extract_tag + run: | + TITLE="${{ github.event.pull_request.title }}" + TAG_NAME=$(echo "$TITLE" | sed 's/release: //') + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + VERSION_TITLE=${TAG_NAME#v} + echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV + + - name: Create Release Body File + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: echo "$PR_BODY" > release_body.md + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ env.TAG_NAME }} \ + --title "${{ env.VERSION_TITLE }}" \ + --notes-file release_body.md \ + --verify-tag From 4b667a058ca7d14aa9960b7834262f5d7ee43a15 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 14:02:47 +0800 Subject: [PATCH 05/24] feat: add change log config --- src/cliff.toml | 85 ++++++++++++++++++++++++++++++++ src/reusable-prepare-release.yml | 2 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/cliff.toml diff --git a/src/cliff.toml b/src/cliff.toml new file mode 100644 index 0000000..976cbe6 --- /dev/null +++ b/src/cliff.toml @@ -0,0 +1,85 @@ +[changelog] +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" + +body = """ +{% if version %}\ + {% if previous.version %}\ + # [{{ version | trim_start_matches(pat="v") }}](https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}/compare/{{ previous.version }}...{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }}) + {% else %}\ + # [{{ version | trim_start_matches(pat="v") }}] ({{ timestamp | date(format="%Y-%m-%d") }}) + {% endif %}\ +{% else %}\ + # [unreleased] +{% endif %}\ + +{% macro group_commits(group_name) %}\ + {% for group, commits in commits | group_by(attribute="group") %}\ + {% if group == group_name %}\ + ### {{ group | upper_first }} + + {% for commit in commits %}\ + * {% if commit.scope %}**{{ commit.scope }}:** {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}/commit/{{ commit.id }})) \ + [@{{ commit.author.name }}](https://github.com/{{ commit.author.name }}) + {% endfor %} + + {% endif %}\ + {% endfor %}\ +{% endmacro %}\ + +{{ self::group_commits(group_name="Bug Fixes") }}\ +{{ self::group_commits(group_name="Features") }}\ +{{ self::group_commits(group_name="Performance") }}\ +{{ self::group_commits(group_name="Refactor") }}\ +{{ self::group_commits(group_name="Testing") }}\ +{{ self::group_commits(group_name="DevOps") }}\ +{{ self::group_commits(group_name="Documentation") }}\ +{{ self::group_commits(group_name="Styling") }}\ +{{ self::group_commits(group_name="Miscellaneous Tasks") }}\ +{{ self::group_commits(group_name="Security") }}\ +{{ self::group_commits(group_name="Revert") }}\ +\n +""" + +footer = """ + +""" + +trim = true +postprocessors = [] + + +[git] +conventional_commits = true +filter_unconventional = true +split_commits = false +commit_preprocessors = [ + { pattern = '^Revert "(.+)"$', replace = "revert $1" }, +] + +commit_parsers = [ + { message = "^fix", group = "Bug Fixes" }, + { message = "^feat", group = "Features" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactor" }, + { message = "^test", group = "Testing" }, + { message = "^ci", group = "DevOps" }, + { message = "^doc", group = "Documentation" }, + { message = "^style", group = "Styling" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore", group = "Miscellaneous Tasks" }, + { body = ".*security", group = "Security" }, + { message = "^[Rr]evert", group = "Revert" }, +] + +protect_breaking_commits = false +filter_commits = false +topo_order = false +sort_commits = "oldest" diff --git a/src/reusable-prepare-release.yml b/src/reusable-prepare-release.yml index afc7a9c..07971c8 100644 --- a/src/reusable-prepare-release.yml +++ b/src/reusable-prepare-release.yml @@ -37,7 +37,7 @@ jobs: with: repository: 'leoweyr/github-release-workflow' path: .change-log-config - sparse-checkout: cliff.toml + sparse-checkout: src/cliff.toml - name: Setup Node.js uses: actions/setup-node@v4 From 7e15921622d59b01fa1f571a707ca4ffad7d5a94 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 14:40:12 +0800 Subject: [PATCH 06/24] docs: update readme with usage instructions --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 80e9be2..64e66b6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ # GitHub Release Workflow Streamline your software delivery with a production-ready engineering workflow. Automated semantic versioning, changelog generation (via git-cliff), and GitHub release publishing. + +> [!IMPORTANT] +> To ensure changelogs are generated correctly, all git commit messages must follow the **[Conventional Commits](https://www.conventionalcommits.org/)** specification. +> +> Also, you must go to your repository **Settings > Actions > General > Workflow permissions** and enable **"Allow GitHub Actions to create and approve pull requests"**, otherwise the automated release process will fail. + +## 🚀 Instant Magic for Your Repository!!! + +Add professional release automation to your personal project with a single step: + +**Simply copy the `.github/workflows` directory from this repository into your project's root.** + +✨ That's it! Your repository is now enchanted. + +## ⚙ How It Works + +This workflow streamlines your release process into a few simple steps: + +1. **Tag Your Release**: On your development branch (separate from `master` or `main`), create a git tag with a `v` prefix (e.g., `v1.0.0`). + ```bash + git tag v1.0.0 + ``` + +2. **Push the Tag**: Push the tag to GitHub. + ```bash + git push origin v1.0.0 + ``` + +3. **Automated Magic**: GitHub Actions will automatically: + * Generate a changelog based on your conventional commits. + * Create a specific release branch. + * Open a Pull Request to your default branch (e.g., `master`). + +4. **Review and Merge**: Review the Pull Request created by the bot. + * **Do not modify the Pull Request title or body**, as they are used for the release metadata. + * Merge the Pull Request. + * The workflow will automatically create a GitHub Release for you. From 04e730fc0a68c554c8b40f65ec949cdc4763ee73 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 15:25:43 +0800 Subject: [PATCH 07/24] chore: add icon --- assets/icon.svg | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 assets/icon.svg diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..8834341 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e81214ea480b1bbd1c63ea78cb7c4c32af085513 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 15:31:04 +0800 Subject: [PATCH 08/24] docs(readme): add banner --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 64e66b6..728da19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# GitHub Release Workflow - -Streamline your software delivery with a production-ready engineering workflow. Automated semantic versioning, changelog generation (via git-cliff), and GitHub release publishing. +![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) > [!IMPORTANT] > To ensure changelogs are generated correctly, all git commit messages must follow the **[Conventional Commits](https://www.conventionalcommits.org/)** specification. From 2ad0a7312fc8b75b7945679a71845ca68efbe43b Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 15:44:14 +0800 Subject: [PATCH 09/24] chore: correct eye perspective in icon --- assets/icon.svg | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/icon.svg b/assets/icon.svg index 8834341..5facd38 100644 --- a/assets/icon.svg +++ b/assets/icon.svg @@ -39,19 +39,19 @@ - - + + - + - - - - + + + + - - + + From 0b0676e413f95b39d33c79d64ffc0259a3783206 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 15:56:18 +0800 Subject: [PATCH 10/24] fix: move reusable workflows back to .github/workflows directory --- .github/workflows/prepare-release.yml | 2 +- .github/workflows/publish-release.yml | 2 +- README.md | 2 +- src/reusable-prepare-release.yml | 94 --------------------------- src/reusable-publish-release.yml | 41 ------------ 5 files changed, 3 insertions(+), 138 deletions(-) delete mode 100644 src/reusable-prepare-release.yml delete mode 100644 src/reusable-publish-release.yml diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index e644bc6..430b75a 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -11,5 +11,5 @@ permissions: jobs: call-prepare: - uses: leoweyr/github-release-workflow/src/reusable-prepare-release.yml@master + uses: leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml@develop secrets: inherit diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3a5817a..9a73cab 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -9,5 +9,5 @@ permissions: jobs: call-publish: - uses: leoweyr/github-release-workflow/src/reusable-publish-release.yml@master + uses: leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml@develop secrets: inherit diff --git a/README.md b/README.md index 728da19..9c376bd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Add professional release automation to your personal project with a single step: -**Simply copy the `.github/workflows` directory from this repository into your project's root.** +**Copy the `prepare-release.yml` and `publish-release.yml` files from `.github/workflows` into your project's `.github/workflows` directory.** ✨ That's it! Your repository is now enchanted. diff --git a/src/reusable-prepare-release.yml b/src/reusable-prepare-release.yml deleted file mode 100644 index 07971c8..0000000 --- a/src/reusable-prepare-release.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Prepare Release - -on: - workflow_call: - inputs: - node-verions: - description: 'Node.js version to use.' - required: false - type: string - default: '20' - commit-user-name: - description: 'Git user name for commit' - required: false - type: string - default: 'github-actions[bot]' - commit-user-email: - description: 'Git user email for commit.' - required: false - type: string - default: 'github-actions[bot]@users.noreply.github.com' - secrets: - GITHUB_TOKEN: - required: true - description: 'GitHub Token for authentication.' - -jobs: - prepare-release: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Checkout Config - uses: actions/checkout@v4 - with: - repository: 'leoweyr/github-release-workflow' - path: .change-log-config - sparse-checkout: src/cliff.toml - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-verions }} - - - name: Set Environment Variables - run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - 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 - env: - GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md - - - name: Save PR Body to File - run: | - cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md - - - name: Update CHANGELOG.md File - env: - GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ -f "CHANGELOG.md" ]; then - # File exists: Prepend new changes (git-cliff intelligently handles headers). - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md - else - # File missing: Create new with full history and header. - npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md - fi - - - name: 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 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh pr create \ - --title "release: ${{ env.TAG_NAME }}" \ - --body-file pr_body_cleaned.md \ - --base master \ - --head release/${{ env.TAG_NAME }} diff --git a/src/reusable-publish-release.yml b/src/reusable-publish-release.yml deleted file mode 100644 index 6a150e0..0000000 --- a/src/reusable-publish-release.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Publish Release - -on: - workflow_call: - secrets: - GITHUB_TOKEN: - required: true - -jobs: - publish-release: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'release:') - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Extract Tag Name - id: extract_tag - run: | - TITLE="${{ github.event.pull_request.title }}" - TAG_NAME=$(echo "$TITLE" | sed 's/release: //') - echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV - VERSION_TITLE=${TAG_NAME#v} - echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV - - - name: Create Release Body File - env: - PR_BODY: ${{ github.event.pull_request.body }} - run: echo "$PR_BODY" > release_body.md - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create ${{ env.TAG_NAME }} \ - --title "${{ env.VERSION_TITLE }}" \ - --notes-file release_body.md \ - --verify-tag From 456d0c9348aad3d41e1d4b61aca8f7cd50194261 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 16:00:43 +0800 Subject: [PATCH 11/24] fix: add missing reusable release workflows --- .../workflows/reusable-prepare-release.yml | 94 +++++++++++++++++++ .../workflows/reusable-publish-release.yml | 41 ++++++++ 2 files changed, 135 insertions(+) create mode 100644 .github/workflows/reusable-prepare-release.yml create mode 100644 .github/workflows/reusable-publish-release.yml diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml new file mode 100644 index 0000000..07971c8 --- /dev/null +++ b/.github/workflows/reusable-prepare-release.yml @@ -0,0 +1,94 @@ +name: Prepare Release + +on: + workflow_call: + inputs: + node-verions: + description: 'Node.js version to use.' + required: false + type: string + default: '20' + commit-user-name: + description: 'Git user name for commit' + required: false + type: string + default: 'github-actions[bot]' + commit-user-email: + description: 'Git user email for commit.' + required: false + type: string + default: 'github-actions[bot]@users.noreply.github.com' + secrets: + GITHUB_TOKEN: + required: true + description: 'GitHub Token for authentication.' + +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Checkout Config + uses: actions/checkout@v4 + with: + repository: 'leoweyr/github-release-workflow' + path: .change-log-config + sparse-checkout: src/cliff.toml + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-verions }} + + - name: Set Environment Variables + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - 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 + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md + + - name: Save PR Body to File + run: | + cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md + + - name: Update CHANGELOG.md File + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -f "CHANGELOG.md" ]; then + # File exists: Prepend new changes (git-cliff intelligently handles headers). + npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md + else + # File missing: Create new with full history and header. + npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md + fi + + - name: 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --title "release: ${{ env.TAG_NAME }}" \ + --body-file pr_body_cleaned.md \ + --base master \ + --head release/${{ env.TAG_NAME }} diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml new file mode 100644 index 0000000..6a150e0 --- /dev/null +++ b/.github/workflows/reusable-publish-release.yml @@ -0,0 +1,41 @@ +name: Publish Release + +on: + workflow_call: + secrets: + GITHUB_TOKEN: + required: true + +jobs: + publish-release: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'release:') + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract Tag Name + id: extract_tag + run: | + TITLE="${{ github.event.pull_request.title }}" + TAG_NAME=$(echo "$TITLE" | sed 's/release: //') + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + VERSION_TITLE=${TAG_NAME#v} + echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV + + - name: Create Release Body File + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: echo "$PR_BODY" > release_body.md + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ env.TAG_NAME }} \ + --title "${{ env.VERSION_TITLE }}" \ + --notes-file release_body.md \ + --verify-tag From 8d2afaa30e97c3c735bfe39b1d822879d834d4de Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 16:05:25 +0800 Subject: [PATCH 12/24] fix: rename reserved GITHUB_TOKEN secret in reusable workflows --- .github/workflows/prepare-release.yml | 3 ++- .github/workflows/publish-release.yml | 3 ++- .github/workflows/reusable-prepare-release.yml | 8 ++++---- .github/workflows/reusable-publish-release.yml | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 430b75a..64658b2 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -12,4 +12,5 @@ permissions: jobs: call-prepare: uses: leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml@develop - secrets: inherit + secrets: + ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 9a73cab..472348f 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -10,4 +10,5 @@ permissions: jobs: call-publish: uses: leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml@develop - secrets: inherit + secrets: + ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml index 07971c8..3e8ed7e 100644 --- a/.github/workflows/reusable-prepare-release.yml +++ b/.github/workflows/reusable-prepare-release.yml @@ -19,7 +19,7 @@ on: type: string default: 'github-actions[bot]@users.noreply.github.com' secrets: - GITHUB_TOKEN: + ACCESS_TOKEN: required: true description: 'GitHub Token for authentication.' @@ -56,7 +56,7 @@ jobs: - name: Generate Changelog Content for PR Body env: GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md @@ -67,7 +67,7 @@ jobs: - name: Update CHANGELOG.md File env: GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | if [ -f "CHANGELOG.md" ]; then # File exists: Prepend new changes (git-cliff intelligently handles headers). @@ -85,7 +85,7 @@ jobs: - name: Create Pull Request env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | gh pr create \ --title "release: ${{ env.TAG_NAME }}" \ diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml index 6a150e0..a49fb3d 100644 --- a/.github/workflows/reusable-publish-release.yml +++ b/.github/workflows/reusable-publish-release.yml @@ -3,7 +3,7 @@ name: Publish Release on: workflow_call: secrets: - GITHUB_TOKEN: + ACCESS_TOKEN: required: true jobs: @@ -33,7 +33,7 @@ jobs: - name: Create GitHub Release env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | gh release create ${{ env.TAG_NAME }} \ --title "${{ env.VERSION_TITLE }}" \ From 7aef3e84c53bacded51601db6dcab4b9e765634e Mon Sep 17 00:00:00 2001 From: leoweyr Date: Fri, 20 Mar 2026 16:16:09 +0800 Subject: [PATCH 13/24] fix: correct git-cliff config path to prevent fallback to default --- .github/workflows/reusable-prepare-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml index 3e8ed7e..3adbdc9 100644 --- a/.github/workflows/reusable-prepare-release.yml +++ b/.github/workflows/reusable-prepare-release.yml @@ -58,7 +58,7 @@ jobs: GITHUB_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --strip all > pr_body_raw.md + npx git-cliff --config .change-log-config/src/cliff.toml --verbose --latest --strip all > pr_body_raw.md - name: Save PR Body to File run: | @@ -71,10 +71,10 @@ jobs: run: | if [ -f "CHANGELOG.md" ]; then # File exists: Prepend new changes (git-cliff intelligently handles headers). - npx git-cliff --config .change-log-config/cliff.toml --verbose --latest --prepend CHANGELOG.md + npx git-cliff --config .change-log-config/src/cliff.toml --verbose --latest --prepend CHANGELOG.md else # File missing: Create new with full history and header. - npx git-cliff --config .change-log-config/cliff.toml --verbose --output CHANGELOG.md + npx git-cliff --config .change-log-config/src/cliff.toml --verbose --output CHANGELOG.md fi - name: Commit and Push From dd5ada5e8272905e52de6406c80e15e7687b5a66 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 22 Mar 2026 20:25:58 +0800 Subject: [PATCH 14/24] fix: ensure revert commits follow conventional format in changelog --- src/cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cliff.toml b/src/cliff.toml index 976cbe6..b5e8c16 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -58,7 +58,7 @@ conventional_commits = true filter_unconventional = true split_commits = false commit_preprocessors = [ - { pattern = '^Revert "(.+)"$', replace = "revert $1" }, + { pattern = '^Revert "(.+)"$', replace = "revert: $1" }, ] commit_parsers = [ From b912f9e46aff2382dc6085b00cc4c8904283eaec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 20 Mar 2026 08:17:46 +0000 Subject: [PATCH 15/24] release: v1.0.0 --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..af3270b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +# [1.0.0] (2026-03-20) +### Bug Fixes + +* move reusable workflows back to .github/workflows directory ([0b0676e](https://github.com/leoweyr/github-release-workflow/commit/0b0676e413f95b39d33c79d64ffc0259a3783206)) [@leoweyr](https://github.com/leoweyr) +* add missing reusable release workflows ([456d0c9](https://github.com/leoweyr/github-release-workflow/commit/456d0c9348aad3d41e1d4b61aca8f7cd50194261)) [@leoweyr](https://github.com/leoweyr) +* rename reserved GITHUB_TOKEN secret in reusable workflows ([8d2afaa](https://github.com/leoweyr/github-release-workflow/commit/8d2afaa30e97c3c735bfe39b1d822879d834d4de)) [@leoweyr](https://github.com/leoweyr) +* correct git-cliff config path to prevent fallback to default ([7aef3e8](https://github.com/leoweyr/github-release-workflow/commit/7aef3e84c53bacded51601db6dcab4b9e765634e)) [@leoweyr](https://github.com/leoweyr) + + +### Features + +* add prepare release workflow ([4bec90f](https://github.com/leoweyr/github-release-workflow/commit/4bec90f7d44eda66efce0e48bec8079a5c98430c)) [@leoweyr](https://github.com/leoweyr) +* add publish release workflow ([20daca8](https://github.com/leoweyr/github-release-workflow/commit/20daca810acd33ee6071d7e5668fca95e203e797)) [@leoweyr](https://github.com/leoweyr) +* add user-facing workflows ([047bf99](https://github.com/leoweyr/github-release-workflow/commit/047bf996a00bb3fae423b17cb3d31a9392184b65)) [@leoweyr](https://github.com/leoweyr) +* add change log config ([4b667a0](https://github.com/leoweyr/github-release-workflow/commit/4b667a058ca7d14aa9960b7834262f5d7ee43a15)) [@leoweyr](https://github.com/leoweyr) + + +### Documentation + +* update readme with usage instructions ([7e15921](https://github.com/leoweyr/github-release-workflow/commit/7e15921622d59b01fa1f571a707ca4ffad7d5a94)) [@leoweyr](https://github.com/leoweyr) +* **readme:** add banner ([e81214e](https://github.com/leoweyr/github-release-workflow/commit/e81214ea480b1bbd1c63ea78cb7c4c32af085513)) [@leoweyr](https://github.com/leoweyr) + + +### Miscellaneous Tasks + +* move reusable workflows to src ([e48851c](https://github.com/leoweyr/github-release-workflow/commit/e48851ca6f5f92f075fae900cfc1332b7a507a20)) [@leoweyr](https://github.com/leoweyr) +* add icon ([04e730f](https://github.com/leoweyr/github-release-workflow/commit/04e730fc0a68c554c8b40f65ec949cdc4763ee73)) [@leoweyr](https://github.com/leoweyr) +* correct eye perspective in icon ([2ad0a73](https://github.com/leoweyr/github-release-workflow/commit/2ad0a7312fc8b75b7945679a71845ca68efbe43b)) [@leoweyr](https://github.com/leoweyr) + + + + From 1eaef1a20d01fc9c1364450edf8835ec28a8cef5 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 22 Mar 2026 21:27:48 +0800 Subject: [PATCH 16/24] fix: prioritize revert commits parsing to prevent misclassification as fixes --- src/cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cliff.toml b/src/cliff.toml index b5e8c16..23e0546 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -62,6 +62,7 @@ commit_preprocessors = [ ] commit_parsers = [ + { message = "^revert", group = "Revert" }, { message = "^fix", group = "Bug Fixes" }, { message = "^feat", group = "Features" }, { message = "^perf", group = "Performance" }, @@ -76,7 +77,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 From 167d2d00feabc34b87df97d9813c5b1ab7a2d27e Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 22 Mar 2026 21:45:05 +0800 Subject: [PATCH 17/24] fix: use type field to correctly classify revert commits in change log --- src/cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cliff.toml b/src/cliff.toml index 23e0546..6f40b4f 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -62,7 +62,7 @@ commit_preprocessors = [ ] commit_parsers = [ - { message = "^revert", group = "Revert" }, + { type = "revert", group = "Revert" }, { message = "^fix", group = "Bug Fixes" }, { message = "^feat", group = "Features" }, { message = "^perf", group = "Performance" }, From 026c69bca35934a55b410dfcb0967c04a45784b5 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 22 Mar 2026 22:01:16 +0800 Subject: [PATCH 18/24] fix: preserve original type/scope in revert commit preprocessing --- src/cliff.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cliff.toml b/src/cliff.toml index 6f40b4f..91d7cc6 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -58,11 +58,12 @@ 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 = [ - { type = "revert", group = "Revert" }, + { message = "^revert", group = "Revert" }, { message = "^fix", group = "Bug Fixes" }, { message = "^feat", group = "Features" }, { message = "^perf", group = "Performance" }, From 5f388b21e821991109aa423c44000d0c1636571f Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sat, 28 Mar 2026 17:11:42 +0800 Subject: [PATCH 19/24] fix(cliff): classify build commits under DevOps --- src/cliff.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cliff.toml b/src/cliff.toml index 91d7cc6..ce34785 100644 --- a/src/cliff.toml +++ b/src/cliff.toml @@ -69,6 +69,7 @@ commit_parsers = [ { 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" }, From 1c00f3daa4c7858d75a591fe313472e561493709 Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 29 Mar 2026 13:02:04 +0800 Subject: [PATCH 20/24] ci: add update used by repos stats workflow --- .../workflows/reusable-prepare-release.yml | 20 ++++---- .../workflows/reusable-publish-release.yml | 8 ++-- .../workflows/update-used-by-repos-stats.yml | 48 +++++++++++++++++++ README.md | 2 + 4 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/update-used-by-repos-stats.yml diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml index 3adbdc9..6a44c20 100644 --- a/.github/workflows/reusable-prepare-release.yml +++ b/.github/workflows/reusable-prepare-release.yml @@ -27,44 +27,44 @@ jobs: prepare-release: runs-on: ubuntu-latest steps: - - name: Checkout Code + - 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,13 +77,13 @@ 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: | diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml index a49fb3d..a59aabb 100644 --- a/.github/workflows/reusable-publish-release.yml +++ b/.github/workflows/reusable-publish-release.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Code + - 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 +26,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..1efb887 --- /dev/null +++ b/.github/workflows/update-used-by-repos-stats.yml @@ -0,0 +1,48 @@ +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: | + REUSABLE_PREPARE_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml"' + REUSABLE_PUBLISH_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml"' + + SEARCH_QUERY="$REUSABLE_PREPARE_RELEASE OR $REUSABLE_PUBLISH_RELEASE path:.github/workflows" + + sleep 5 + + echo "🔍 Searching for: $SEARCH_QUERY" + + COUNT=$(gh api -X GET search/code \ + -F q="$SEARCH_QUERY" \ + -F per_page=100 \ + --jq '[.items[].repository.full_name] | unique | length') + + if [ -z "$COUNT" ] || [ "$COUNT" == "null" ]; then + COUNT=0 + 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/README.md b/README.md index 9c376bd..14c4b1b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ![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) +![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. > From 4c3e1924b3628575dd60216fd88c1699834b193e Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 29 Mar 2026 13:27:49 +0800 Subject: [PATCH 21/24] ci: stabilize reusable workflow dependency search --- .../workflows/update-used-by-repos-stats.yml | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/update-used-by-repos-stats.yml b/.github/workflows/update-used-by-repos-stats.yml index 1efb887..b4d1df4 100644 --- a/.github/workflows/update-used-by-repos-stats.yml +++ b/.github/workflows/update-used-by-repos-stats.yml @@ -15,22 +15,34 @@ jobs: env: GH_TOKEN: ${{ secrets.APP_GITHUB_TOKEN }} run: | - REUSABLE_PREPARE_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml"' - REUSABLE_PUBLISH_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml"' - - SEARCH_QUERY="$REUSABLE_PREPARE_RELEASE OR $REUSABLE_PUBLISH_RELEASE path:.github/workflows" - - sleep 5 - - echo "🔍 Searching for: $SEARCH_QUERY" - - COUNT=$(gh api -X GET search/code \ - -F q="$SEARCH_QUERY" \ - -F per_page=100 \ - --jq '[.items[].repository.full_name] | unique | length') - - if [ -z "$COUNT" ] || [ "$COUNT" == "null" ]; then + 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." From 86c093b0a8ea79899530578d3a86c452cd1cdb4c Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 29 Mar 2026 13:42:13 +0800 Subject: [PATCH 22/24] feat: add tracker for reusable workflow usage --- .github/workflows/reusable-prepare-release.yml | 5 +++++ .github/workflows/reusable-publish-release.yml | 5 +++++ README.md | 1 + 3 files changed, 11 insertions(+) diff --git a/.github/workflows/reusable-prepare-release.yml b/.github/workflows/reusable-prepare-release.yml index 6a44c20..891ba7c 100644 --- a/.github/workflows/reusable-prepare-release.yml +++ b/.github/workflows/reusable-prepare-release.yml @@ -27,6 +27,11 @@ jobs: prepare-release: runs-on: ubuntu-latest steps: + - 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: diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml index a59aabb..1303a71 100644 --- a/.github/workflows/reusable-publish-release.yml +++ b/.github/workflows/reusable-publish-release.yml @@ -12,6 +12,11 @@ jobs: runs-on: ubuntu-latest steps: + - 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: diff --git a/README.md b/README.md index 14c4b1b..6a699e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ![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] From 80556c58d324283358c651fee2049b8b030d62cd Mon Sep 17 00:00:00 2001 From: leoweyr Date: Sun, 29 Mar 2026 13:47:05 +0800 Subject: [PATCH 23/24] fix: make release base branch configurable via reusable workflow input --- .github/workflows/prepare-release.yml | 2 ++ .github/workflows/reusable-prepare-release.yml | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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 891ba7c..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 @@ -95,5 +100,5 @@ jobs: 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 }} From b637fd1b0e65b9688c8c4d22a2c0c566f1dabf2d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 29 Mar 2026 05:49:25 +0000 Subject: [PATCH 24/24] release: v1.0.1 --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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