Skip to content

Commit 0a655ad

Browse files
authored
Merge pull request #1 from LexianDEV/copilot/fix-32610bab-38be-4026-84b8-7f04d46709c4
Switch from auto-generated release notes to Keep A Changelog format with documentation
2 parents 344f898 + fd5ca6f commit 0a655ad

File tree

4 files changed

+155
-3
lines changed

4 files changed

+155
-3
lines changed

.github/workflows/build_for_linux.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,34 @@ jobs:
4141
name: dev-build
4242
path: dist
4343

44+
- name: Extract changelog entry
45+
if: startsWith(github.ref, 'refs/tags/')
46+
id: changelog
47+
run: |
48+
version=${GITHUB_REF_NAME#v}
49+
echo "Extracting changelog for version $version"
50+
51+
# Extract the changelog section for this version
52+
if grep -q "## \[$version\]" CHANGELOG.md; then
53+
# Extract content between this version and the next version heading or links section
54+
changelog_content=$(awk "/## \[$version\]/{flag=1; next} /## \[|^\[.*\]:/{flag=0} flag" CHANGELOG.md | sed '/^$/d')
55+
echo "Changelog content found for version $version"
56+
else
57+
echo "No changelog entry found for version $version, using default message"
58+
changelog_content="Release $version - See CHANGELOG.md for details"
59+
fi
60+
61+
# Store in output for use in release step
62+
echo "content<<EOF" >> $GITHUB_OUTPUT
63+
echo "$changelog_content" >> $GITHUB_OUTPUT
64+
echo "EOF" >> $GITHUB_OUTPUT
65+
4466
- name: Upload Release Asset
4567
if: startsWith(github.ref, 'refs/tags/')
4668
uses: softprops/action-gh-release@v1
4769
with:
4870
files: dist/Application
4971
prerelease: ${{ startsWith(github.ref_name, 'b') }}
50-
generate_release_notes: true
72+
body: ${{ steps.changelog.outputs.content }}
5173
env:
5274
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build_for_windows..yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,35 @@ jobs:
3636
name: dev-build
3737
path: dist
3838

39+
- name: Extract changelog entry
40+
if: startsWith(github.ref, 'refs/tags/')
41+
id: changelog
42+
shell: bash
43+
run: |
44+
version=${GITHUB_REF_NAME#v}
45+
echo "Extracting changelog for version $version"
46+
47+
# Extract the changelog section for this version
48+
if grep -q "## \[$version\]" CHANGELOG.md; then
49+
# Extract content between this version and the next version heading or links section
50+
changelog_content=$(awk "/## \[$version\]/{flag=1; next} /## \[|^\[.*\]:/{flag=0} flag" CHANGELOG.md | sed '/^$/d')
51+
echo "Changelog content found for version $version"
52+
else
53+
echo "No changelog entry found for version $version, using default message"
54+
changelog_content="Release $version - See CHANGELOG.md for details"
55+
fi
56+
57+
# Store in output for use in release step
58+
echo "content<<EOF" >> $GITHUB_OUTPUT
59+
echo "$changelog_content" >> $GITHUB_OUTPUT
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
3962
- name: Upload Release Asset
4063
if: startsWith(github.ref, 'refs/tags/')
4164
uses: softprops/action-gh-release@v1
4265
with:
4366
files: dist/Application.exe
4467
prerelease: ${{ startsWith(github.ref_name, 'b') }}
45-
generate_release_notes: true
68+
body: ${{ steps.changelog.outputs.content }}
4669
env:
4770
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Changed
11+
- Switched from auto-generated release notes to Keep A Changelog format
12+
13+
## [1.0.0] - 2024-08-22
14+
15+
### Added
16+
- Initial Python template application
17+
- Basic time display functionality
18+
- PyInstaller build configuration for Linux and Windows
19+
- GitHub Actions workflows for automated builds
20+
- Cross-platform executable generation
21+
22+
### Fixed
23+
- Initial release with basic functionality
24+
25+
[Unreleased]: https://github.com/LexianDEV/general-py-template/compare/v1.0.0...HEAD
26+
[1.0.0]: https://github.com/LexianDEV/general-py-template/releases/tag/v1.0.0

readme.md

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,85 @@
11
## Template
22
This is a template for a **GENERAL APPLICATION** built in Python.
33

4-
It was developed by LexianDEV
4+
It was developed by LexianDEV
5+
6+
## Changelog Management
7+
8+
This project uses the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for documenting changes. The changelog is maintained in the `CHANGELOG.md` file and **must be edited manually** when making changes to the project.
9+
10+
### How to Update the Changelog
11+
12+
#### 1. Adding New Changes (Unreleased Section)
13+
When you make changes to the project, add them to the `[Unreleased]` section at the top of the changelog:
14+
15+
```markdown
16+
## [Unreleased]
17+
18+
### Added
19+
- New feature you added
20+
21+
### Changed
22+
- Something you modified
23+
24+
### Deprecated
25+
- Feature that will be removed in future versions
26+
27+
### Removed
28+
- Feature you removed
29+
30+
### Fixed
31+
- Bug you fixed
32+
33+
### Security
34+
- Security improvement you made
35+
```
36+
37+
#### 2. Creating a New Release
38+
When you're ready to release a new version:
39+
40+
1. **Move unreleased changes** from the `[Unreleased]` section to a new version section
41+
2. **Set the release date** in the format `[X.Y.Z] - YYYY-MM-DD`
42+
3. **Update the links** at the bottom of the file
43+
4. **Leave the `[Unreleased]` section empty** for future changes
44+
45+
Example:
46+
```markdown
47+
## [Unreleased]
48+
49+
## [1.1.0] - 2024-12-20
50+
51+
### Added
52+
- New feature you added
53+
54+
### Fixed
55+
- Bug you fixed
56+
57+
## [1.0.0] - 2024-08-22
58+
...
59+
```
60+
61+
#### 3. Automated Release Integration
62+
The GitHub Actions workflows automatically extract the appropriate changelog section for each release:
63+
- When you create a tag/release, the workflow finds the matching version in the changelog
64+
- It extracts only that version's content for the release notes
65+
- If no matching section is found, it provides a fallback message
66+
67+
### Best Practices
68+
69+
- **Always update the changelog** when making meaningful changes
70+
- **Use present tense** for changelog entries ("Add feature" not "Added feature")
71+
- **Be specific and clear** about what changed
72+
- **Group related changes** under the appropriate category
73+
- **Link to issues/PRs** when relevant using `[#123](link)` format
74+
- **Follow semantic versioning** for version numbers
75+
76+
### Example Workflow
77+
78+
1. Make changes to your code
79+
2. Add entries to the `[Unreleased]` section in `CHANGELOG.md`
80+
3. Commit your changes
81+
4. When ready to release:
82+
- Move unreleased items to a new version section
83+
- Update version links
84+
- Create a git tag
85+
- GitHub Actions will automatically create a release with the changelog content

0 commit comments

Comments
 (0)