Skip to content

Commit

Permalink
Changelog update command (#214)
Browse files Browse the repository at this point in the history
* fix github release ci

* add changelog update command and doc
  • Loading branch information
sphamba authored Mar 22, 2024
1 parent ffd11d4 commit 2a15749
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 25 deletions.
36 changes: 15 additions & 21 deletions .github/workflows/release_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout source
Expand All @@ -33,30 +35,22 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Get Asset name
if: success() || failure()
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
echo "asset_name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
if: success() || failure()
id: create_release
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip
name: ${{ github.ref }}
tag_name: ${{ github.ref }}
files: |
dist/${{ env.asset_name }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Changelog

All notable changes to **disdrodb** will be documented in this file.

## [0.0.2] - Glorious Green - XXXX-XX-XX
## Version 0.0.2 - Glorious Green - XXXX-XX-XX

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

## [0.0.1] - DISDRODB Birth Date - 2023-01-30
## Version 0.0.1 - DISDRODB Birth Date - 2023-01-30

First release of DISDRODB.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Pass arguments to make: https://stackoverflow.com/a/6273809

changelog:
@echo "Updating CHANGELOG.md..."

@# Generate CHANGELOG.temp
@loghub ghiggi/pycolorbar

@# Put version in CHANGELOG.temp
@sed -i 's/<RELEASE_VERSION>/$(filter-out $@,$(MAKECMDGOALS))/g' CHANGELOG.temp

@# Remove "# Changelog" header from CHANGELOG.md
@sed -i '/# Changelog/d' CHANGELOG.md

@# Append CHANGELOG.temp to the top of CHANGELOG.md
@cat CHANGELOG.md >> CHANGELOG.temp
@mv CHANGELOG.temp CHANGELOG.md

@# Add "# Changelog" header to CHANGELOG.md
@sed -i '1s/^/# Changelog\n\n/' CHANGELOG.md

@echo "Done."

%:
@:
30 changes: 30 additions & 0 deletions docs/source/maintainers_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,36 @@ Examples of non-breaking changes include :
- Internal function refactoring that does not affect the behavior of the software directly.


Release process
---------------

Before releasing a new version, the ``CHANGELOG.md`` file should be updated. Run

.. code-block:: bash
make changelog X.Y.Z
to update the ``CHANGELOG.md`` file with the list of issues and pull requests that have been closed since the last release.
Manually add a description to the release if necessary.

Then, commit the new ``CHANGELOG.md`` file.

.. code-block:: bash
git add CHANGELOG.md
git commit -m "update CHANGELOG.md for version X.Y.Z"
git push
Create a new tag to trigger the release process.

.. code-block:: bash
git tag -a vX.Y.Z -m "Version X.Y.Z"
git push --tags
On GitHub, edit the release description to add the list of changes from the ``CHANGELOG.md`` file.


Ongoing version support
-----------------------------------

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dev = [
"setuptools",
"build",
"twine",
"loghub",
]

[project.urls]
Expand Down

0 comments on commit 2a15749

Please sign in to comment.