Skip to content

Commit 2a15749

Browse files
authored
Changelog update command (#214)
* fix github release ci * add changelog update command and doc
1 parent ffd11d4 commit 2a15749

File tree

5 files changed

+73
-25
lines changed

5 files changed

+73
-25
lines changed

.github/workflows/release_to_pypi.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
build-n-publish:
99
name: Build and publish to PyPI
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1113

1214
steps:
1315
- name: Checkout source
@@ -33,30 +35,22 @@ jobs:
3335
user: __token__
3436
password: ${{ secrets.PYPI_API_TOKEN }}
3537

36-
- name: Create GitHub Release
37-
id: create_release
38-
uses: actions/create-release@v1
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
41-
with:
42-
tag_name: ${{ github.ref }}
43-
release_name: ${{ github.ref }}
44-
draft: false
45-
prerelease: false
46-
4738
- name: Get Asset name
39+
if: success() || failure()
4840
run: |
4941
export PKG=$(ls dist/ | grep tar)
5042
set -- $PKG
51-
echo "name=$1" >> $GITHUB_ENV
43+
echo "asset_name=$1" >> $GITHUB_ENV
5244
53-
- name: Upload Release Asset (sdist) to GitHub
54-
id: upload-release-asset
55-
uses: actions/upload-release-asset@v1
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Create GitHub Release
46+
if: success() || failure()
47+
id: create_release
48+
uses: softprops/action-gh-release@v2
5849
with:
59-
upload_url: ${{ steps.create_release.outputs.upload_url }}
60-
asset_path: dist/${{ env.name }}
61-
asset_name: ${{ env.name }}
62-
asset_content_type: application/zip
50+
name: ${{ github.ref }}
51+
tag_name: ${{ github.ref }}
52+
files: |
53+
dist/${{ env.asset_name }}
54+
draft: false
55+
prerelease: false
56+
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Changelog
22

3-
All notable changes to **disdrodb** will be documented in this file.
4-
5-
## [0.0.2] - Glorious Green - XXXX-XX-XX
3+
## Version 0.0.2 - Glorious Green - XXXX-XX-XX
64

75
### Enhancements
86
- TODO
@@ -13,6 +11,6 @@ All notable changes to **disdrodb** will be documented in this file.
1311
### Bugfixes
1412
- TODO
1513

16-
## [0.0.1] - DISDRODB Birth Date - 2023-01-30
14+
## Version 0.0.1 - DISDRODB Birth Date - 2023-01-30
1715

1816
First release of DISDRODB.

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Pass arguments to make: https://stackoverflow.com/a/6273809
2+
3+
changelog:
4+
@echo "Updating CHANGELOG.md..."
5+
6+
@# Generate CHANGELOG.temp
7+
@loghub ghiggi/pycolorbar
8+
9+
@# Put version in CHANGELOG.temp
10+
@sed -i 's/<RELEASE_VERSION>/$(filter-out $@,$(MAKECMDGOALS))/g' CHANGELOG.temp
11+
12+
@# Remove "# Changelog" header from CHANGELOG.md
13+
@sed -i '/# Changelog/d' CHANGELOG.md
14+
15+
@# Append CHANGELOG.temp to the top of CHANGELOG.md
16+
@cat CHANGELOG.md >> CHANGELOG.temp
17+
@mv CHANGELOG.temp CHANGELOG.md
18+
19+
@# Add "# Changelog" header to CHANGELOG.md
20+
@sed -i '1s/^/# Changelog\n\n/' CHANGELOG.md
21+
22+
@echo "Done."
23+
24+
%:
25+
@:

docs/source/maintainers_guidelines.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,36 @@ Examples of non-breaking changes include :
4949
- Internal function refactoring that does not affect the behavior of the software directly.
5050

5151

52+
Release process
53+
---------------
54+
55+
Before releasing a new version, the ``CHANGELOG.md`` file should be updated. Run
56+
57+
.. code-block:: bash
58+
59+
make changelog X.Y.Z
60+
61+
to update the ``CHANGELOG.md`` file with the list of issues and pull requests that have been closed since the last release.
62+
Manually add a description to the release if necessary.
63+
64+
Then, commit the new ``CHANGELOG.md`` file.
65+
66+
.. code-block:: bash
67+
68+
git add CHANGELOG.md
69+
git commit -m "update CHANGELOG.md for version X.Y.Z"
70+
git push
71+
72+
Create a new tag to trigger the release process.
73+
74+
.. code-block:: bash
75+
76+
git tag -a vX.Y.Z -m "Version X.Y.Z"
77+
git push --tags
78+
79+
On GitHub, edit the release description to add the list of changes from the ``CHANGELOG.md`` file.
80+
81+
5282
Ongoing version support
5383
-----------------------------------
5484

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dev = [
4848
"setuptools",
4949
"build",
5050
"twine",
51+
"loghub",
5152
]
5253

5354
[project.urls]

0 commit comments

Comments
 (0)