github-actions[bot] commited on
Commit
7472dd6
Β·
1 Parent(s): 443292f

ci: Replace cliff.toml with updated changelog configuration and enhance build workflow with manual tag input

Browse files
Files changed (3) hide show
  1. .github/cliff.toml +79 -0
  2. .github/workflows/build.yml +45 -19
  3. cliff.toml +0 -49
.github/cliff.toml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [changelog]
2
+ header = """
3
+ """
4
+ body = """
5
+ {% if version -%}
6
+ {% if previous.version -%}
7
+ ## Changes in {{ version }}
8
+ {% else -%}
9
+ ## Initial Release
10
+ {% endif -%}
11
+ {% else -%}
12
+ ## Recent Changes
13
+ {% endif -%}
14
+
15
+ {% if breaking_commits %}
16
+ ### πŸ’₯ Breaking Changes
17
+ {% for commit in breaking_commits -%}
18
+ - {{ commit.message | split(pat="\n") | first | trim }} ([`{{ commit.id | truncate(length=7, end="") }}`]({{ repository_url }}/commit/{{ commit.id }})) by @{{ commit.author.name }}
19
+ {% endfor -%}
20
+ {% endif -%}
21
+
22
+ {% for group, commits in commits | group_by(attribute="group") %}
23
+ ### {{ group }}
24
+ {% for commit in commits -%}
25
+ - {{ commit.message | split(pat="\n") | first | trim }} ([`{{ commit.id | truncate(length=7, end="") }}`]({{ repository_url }}/commit/{{ commit.id }})) by @{{ commit.author.name }}
26
+ {% endfor -%}
27
+ {% endfor -%}
28
+ """
29
+ footer = ""
30
+
31
+ [git]
32
+ conventional_commits = true
33
+ filter_unconventional = false
34
+ split_commits = false
35
+ commit_preprocessors = [
36
+ { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}]({{ repository_url }}/issues/${2}))"},
37
+ ]
38
+
39
+ commit_parsers = [
40
+ # Scoped commits (most specific)
41
+ { message = "^\\w+\\(ci\\)", group = "πŸ€– Continuous Integration" },
42
+ { message = "^\\w+\\(build\\)", group = "πŸ“¦ Build System" },
43
+ { message = "^\\w+\\(docs\\)", group = "πŸ“š Documentation" },
44
+ { message = "^\\w+\\(test\\)", group = "βœ… Testing" },
45
+ { message = "^\\w+\\(style\\)", group = "🎨 Styling" },
46
+ { message = "^\\w+\\(perf\\)", group = "⚑ Performance Improvements" },
47
+ { message = "^\\w+\\(refactor\\)", group = "♻️ Code Refactoring" },
48
+ { message = "^\\w+\\(security\\)", group = "πŸ”’ Security" },
49
+
50
+ # Conventional commits (less specific)
51
+ { message = "^feat", group = "πŸš€ Features" },
52
+ { message = "^feature", group = "πŸš€ Features" },
53
+ { message = "^fix", group = "πŸ› Bug Fixes" },
54
+ { message = "^bug", group = "πŸ› Bug Fixes" },
55
+ { message = "^patch", group = "πŸ› Bug Fixes" },
56
+ { message = "^perf", group = "⚑ Performance Improvements" },
57
+ { message = "^refactor", group = "♻️ Code Refactoring" },
58
+ { message = "^revert", group = "βͺ Reverts" },
59
+ { message = "^style", group = "🎨 Styling" },
60
+ { message = "^test", group = "βœ… Testing" },
61
+ { message = "^tests", group = "βœ… Testing" },
62
+ { message = "^doc", group = "πŸ“š Documentation" },
63
+ { message = "^docs", group = "πŸ“š Documentation" },
64
+ { message = "^build", group = "πŸ“¦ Build System" },
65
+ { message = "^ci", group = "πŸ€– Continuous Integration" },
66
+ { message = "^chore", group = "🧹 Miscellaneous Chores" },
67
+
68
+ # Other
69
+ { body = ".*security", group = "πŸ”’ Security" },
70
+ { message = ".*", group = "πŸ”§ Other Changes" },
71
+ ]
72
+
73
+ protect_breaking_commits = true
74
+ filter_commits = false
75
+ tag_pattern = "build-*"
76
+ skip_tags = ""
77
+ ignore_tags = ""
78
+ topo_order = false
79
+ sort_commits = "newest"
.github/workflows/build.yml CHANGED
@@ -2,6 +2,11 @@ name: Build and Release Executable
2
 
3
  on:
4
  workflow_dispatch:
 
 
 
 
 
5
  push:
6
  paths:
7
  - 'src/proxy_app/**'
@@ -105,7 +110,7 @@ jobs:
105
  shell: bash
106
  run: |
107
  # Inject the GitHub repo URL into your template
108
- sed -i "s|{{ repository_url }}|https://github.com/${GITHUB_REPOSITORY}|g" cliff.toml
109
  echo "βœ… cliff.toml:"
110
  head -20 cliff.toml
111
 
@@ -113,15 +118,21 @@ jobs:
113
  id: changelog
114
  shell: bash
115
  run: |
116
- echo "▢️ All build-* tags found:"; git tag --list 'build-*'
117
- LAST_TAG="1d97578"
118
- echo "βœ… Detected most recent ancestor tag: $LAST_TAG"
 
 
 
 
 
 
119
 
120
  if [ -n "$LAST_TAG" ]; then
121
  # Standard run: A previous tag was found.
122
  echo "πŸ” Generating changelog for range: $LAST_TAG..HEAD"
123
- git-cliff \
124
- --config cliff.toml \
125
  --strip all \
126
  --output changelog.md \
127
  "$LAST_TAG..HEAD"
@@ -185,28 +196,43 @@ jobs:
185
  fi
186
 
187
  COMMIT_COUNT=$(git rev-list --count HEAD)
188
- CONTRIBUTORS=$(git log --format='%an' | sort -u | wc -l)
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
  echo "build_size=$BUILD_SIZE" >> $GITHUB_OUTPUT
191
  echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
192
- echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT
193
 
194
  echo "πŸ“Š Build metadata:"
195
  echo " - Size: $BUILD_SIZE"
196
  echo " - Commits: $COMMIT_COUNT"
197
- echo " - Contributors: $CONTRIBUTORS"
198
 
199
  - name: Create Release
200
  shell: bash
201
  run: |
 
202
  if [ "${{ steps.changelog.outputs.has_changelog }}" == "true" ]; then
203
  echo "${{ steps.changelog.outputs.changelog_b64 }}" | base64 -d > decoded_changelog.md
204
  CHANGELOG_CONTENT=$(cat decoded_changelog.md)
205
  else
206
  CHANGELOG_CONTENT="No significant changes detected in this release."
207
  fi
208
-
209
- NOTES="## Build Information
 
 
210
  | Field | Value |
211
  |-------|-------|
212
  | πŸ“¦ **Version** | \`${{ steps.version.outputs.version }}\` |
@@ -214,8 +240,6 @@ jobs:
214
  | πŸ”— **Commit** | [\`${{ needs.build.outputs.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
215
  | πŸ“… **Build Date** | \`${{ steps.version.outputs.timestamp }}\` |
216
  | ⚑ **Trigger** | \`${{ github.event_name }}\` |
217
- | πŸ‘₯ **Total Contributors** | \`${{ steps.metadata.outputs.contributors }}\` |
218
- | πŸ“Š **Total Commits** | \`${{ steps.metadata.outputs.commit_count }}\` |
219
 
220
  ## πŸ“‹ What's Changed
221
 
@@ -224,9 +248,9 @@ jobs:
224
  ### πŸ“ Included Files
225
  | File | Description | Size |
226
  |------|-------------|------|
227
- | \`proxy_app.exe\` | Main application executable | Primary |
228
- | \`setup_env.bat\` | Environment setup script | Helper |
229
- | \`.env.example\` | Configuration template | Template |
230
 
231
  ## πŸ”— Useful Links
232
  - πŸ“– [Documentation](https://github.com/${{ github.repository }}/wiki)
@@ -236,13 +260,15 @@ jobs:
236
 
237
  ---
238
 
239
- > **Note**: This is an automated build release."
240
 
241
- NOTES="$NOTES\n\n**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.changelog.outputs.previous_tag }}...build-${{ steps.version.outputs.version }}"
 
242
 
 
243
  gh release create build-${{ steps.version.outputs.version }} \
244
  --title "Build ${{ steps.version.outputs.version }}" \
245
- --notes "$NOTES" \
246
  --latest \
247
  ${{ steps.archive.outputs.ASSET_PATH }}
248
  env:
 
2
 
3
  on:
4
  workflow_dispatch:
5
+ inputs:
6
+ manual_previous_tag:
7
+ description: 'Optional: Manually set the previous tag to generate the changelog from.'
8
+ required: false
9
+ default: ''
10
  push:
11
  paths:
12
  - 'src/proxy_app/**'
 
110
  shell: bash
111
  run: |
112
  # Inject the GitHub repo URL into your template
113
+ sed -i "s|{{ repository_url }}|https://github.com/${GITHUB_REPOSITORY}|g" .github/cliff.toml
114
  echo "βœ… cliff.toml:"
115
  head -20 cliff.toml
116
 
 
118
  id: changelog
119
  shell: bash
120
  run: |
121
+ if [ -n "${{ github.event.inputs.manual_previous_tag }}" ]; then
122
+ echo "Manual tag provided: ${{ github.event.inputs.manual_previous_tag }}"
123
+ LAST_TAG="${{ github.event.inputs.manual_previous_tag }}"
124
+ else
125
+ echo "No manual tag provided, searching for the latest build-* tag..."
126
+ LAST_TAG=$(git describe --tags --abbrev=0 --match="build-*" 2>/dev/null || echo "")
127
+ fi
128
+
129
+ echo "βœ… Using tag: $LAST_TAG"
130
 
131
  if [ -n "$LAST_TAG" ]; then
132
  # Standard run: A previous tag was found.
133
  echo "πŸ” Generating changelog for range: $LAST_TAG..HEAD"
134
+ git-cliff \
135
+ --config .github/cliff.toml \
136
  --strip all \
137
  --output changelog.md \
138
  "$LAST_TAG..HEAD"
 
196
  fi
197
 
198
  COMMIT_COUNT=$(git rev-list --count HEAD)
199
+
200
+ # Generate rich contributor list
201
+ CONTRIBUTOR_LOG=$(git log ${{ steps.changelog.outputs.previous_tag }}..HEAD --format='%ae' | sort -u)
202
+ CONTRIBUTORS_LIST=""
203
+ while read -r email; do
204
+ # Find user by email
205
+ USER_INFO=$(gh api "search/users?q=$email+in:email" --jq '.items[0]')
206
+ if [ -n "$USER_INFO" ]; then
207
+ USERNAME=$(echo "$USER_INFO" | jq -r '.login')
208
+ AVATAR_URL=$(echo "$USER_INFO" | jq -r '.avatar_url')
209
+ CONTRIBUTORS_LIST="$CONTRIBUTORS_LIST [![$USERNAME](https://images.weserv.nl/?url=$AVATAR_URL&w=32&h=32&fit=cover&mask=circle)](https://github.com/$USERNAME) "
210
+ fi
211
+ done <<< "$CONTRIBUTOR_LOG"
212
 
213
  echo "build_size=$BUILD_SIZE" >> $GITHUB_OUTPUT
214
  echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
215
+ echo "contributors_list=$CONTRIBUTORS_LIST" >> $GITHUB_OUTPUT
216
 
217
  echo "πŸ“Š Build metadata:"
218
  echo " - Size: $BUILD_SIZE"
219
  echo " - Commits: $COMMIT_COUNT"
220
+ echo " - Contributors: $CONTRIBUTORS_LIST"
221
 
222
  - name: Create Release
223
  shell: bash
224
  run: |
225
+ # Prepare changelog content
226
  if [ "${{ steps.changelog.outputs.has_changelog }}" == "true" ]; then
227
  echo "${{ steps.changelog.outputs.changelog_b64 }}" | base64 -d > decoded_changelog.md
228
  CHANGELOG_CONTENT=$(cat decoded_changelog.md)
229
  else
230
  CHANGELOG_CONTENT="No significant changes detected in this release."
231
  fi
232
+
233
+ # Prepare the full release notes in a temporary file
234
+ cat > releasenotes.md <<-EOF
235
+ ## Build Information
236
  | Field | Value |
237
  |-------|-------|
238
  | πŸ“¦ **Version** | \`${{ steps.version.outputs.version }}\` |
 
240
  | πŸ”— **Commit** | [\`${{ needs.build.outputs.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
241
  | πŸ“… **Build Date** | \`${{ steps.version.outputs.timestamp }}\` |
242
  | ⚑ **Trigger** | \`${{ github.event_name }}\` |
 
 
243
 
244
  ## πŸ“‹ What's Changed
245
 
 
248
  ### πŸ“ Included Files
249
  | File | Description | Size |
250
  |------|-------------|------|
251
+ | \`proxy_app.exe\` | Main application executable |
252
+ | \`setup_env.bat\` | Environment setup script |
253
+ | \`.env.example\` | Configuration template |
254
 
255
  ## πŸ”— Useful Links
256
  - πŸ“– [Documentation](https://github.com/${{ github.repository }}/wiki)
 
260
 
261
  ---
262
 
263
+ > **Note**: This is an automated build release.
264
 
265
+ **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.changelog.outputs.previous_tag }}...build-${{ steps.version.outputs.version }}
266
+ EOF
267
 
268
+ # Create the release using the notes file
269
  gh release create build-${{ steps.version.outputs.version }} \
270
  --title "Build ${{ steps.version.outputs.version }}" \
271
+ --notes-file releasenotes.md \
272
  --latest \
273
  ${{ steps.archive.outputs.ASSET_PATH }}
274
  env:
cliff.toml DELETED
@@ -1,49 +0,0 @@
1
- [changelog]
2
- header = """
3
- """
4
- body = """
5
- {% if version -%}
6
- ## Changes in {{ version }}
7
- {% else -%}
8
- ## Recent Changes
9
- {% endif -%}
10
- {% for group, commits in commits | group_by(attribute="group") %}
11
- ### {{ group }}
12
- {% for commit in commits -%}
13
- - {{ commit.message | split(pat="\n") | first | trim }} ([`{{ commit.id | truncate(length=7, end="") }}`]({{ repository_url }}/commit/{{ commit.id }}))
14
- {% endfor -%}
15
- {% endfor -%}
16
- """
17
- footer = ""
18
-
19
- [git]
20
- conventional_commits = true
21
- filter_unconventional = false
22
- split_commits = false
23
- commit_preprocessors = [
24
- { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}]({{ repository_url }}/issues/${2}))"},
25
- ]
26
-
27
- commit_parsers = [
28
- { message = "^feat", group = "Features"},
29
- { message = "^fix", group = "Bug Fixes"},
30
- { message = "^doc", group = "Documentation"},
31
- { message = "^perf", group = "Performance"},
32
- { message = "^refactor", group = "Refactor"},
33
- { message = "^style", group = "Styling"},
34
- { message = "^test", group = "Testing"},
35
- { message = "^chore\\(release\\):", skip = true},
36
- { message = "^chore", group = "Miscellaneous Tasks"},
37
- { message = "^build", group = "Build System"},
38
- { message = "^ci", group = "Continuous Integration"},
39
- { body = ".*security", group = "Security"},
40
- { message = ".*", group = "Other Changes"},
41
- ]
42
-
43
- protect_breaking_commits = true
44
- filter_commits = false
45
- tag_pattern = "build-*"
46
- skip_tags = ""
47
- ignore_tags = ""
48
- topo_order = false
49
- sort_commits = "newest"