-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
838 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import os | ||
import logging | ||
from datetime import datetime | ||
from packaging import version | ||
|
||
script_root = os.path.dirname(__file__) | ||
laktory_root = "./settus/" | ||
|
||
|
||
def main(): | ||
|
||
# Filepaths | ||
version_filepath = os.path.join(laktory_root, "_version.py") | ||
local_env_filepath = os.path.join(script_root, "git.env") | ||
git_env_filepath = os.getenv("GITHUB_OUTPUT", local_env_filepath) | ||
changelog_filepath = os.path.join("./", "CHANGELOG.md") | ||
|
||
# Read version file | ||
with open(version_filepath) as fp: | ||
v0 = fp.read().split("=")[-1].strip().replace('"', '') | ||
v0 = version.parse(v0) | ||
v1 = version.Version(f"{v0.major}.{v0.minor}.{v0.micro + 1}") | ||
print(f"Bumping laktory to {v1}") | ||
|
||
# Update version file | ||
print(f"Updating _version.py") | ||
with open(version_filepath, "w") as fp: | ||
fp.write(f'VERSION = "{v1}"') | ||
|
||
# Set version as git action variable | ||
print(f"Setting git env var version {git_env_filepath}") | ||
with open(git_env_filepath, 'a') as fp: | ||
fp.write(f"version={v1}") | ||
|
||
# Update CHANGELOG | ||
update_changelog(changelog_filepath, v0, v1) | ||
|
||
# Cleanup | ||
if git_env_filepath == local_env_filepath and os.path.exists(local_env_filepath): | ||
os.remove(local_env_filepath) | ||
|
||
|
||
def update_changelog(changelog_filepath, v0, v1): | ||
|
||
# Update CHANGELOG | ||
print(f"Updating changelog") | ||
with open(changelog_filepath, 'r') as fp: | ||
content = fp.read() | ||
|
||
# Set version line | ||
version_line = f'## [{v0}] - Unreleased' | ||
|
||
# Validate | ||
if version_line not in content: | ||
msg = f"CHANGELOG does not include version {v0}" | ||
print('ValueError: ' + msg) | ||
raise ValueError(msg) | ||
|
||
# Update current version release date | ||
today = datetime.utcnow() | ||
new_version_line = f"## [{v0}] - {today.strftime('%Y-%m-%d')}" | ||
content = content.replace(version_line, new_version_line) | ||
|
||
# Add placeholder for next version | ||
next_version_lines = [ | ||
'# Release History', | ||
'', | ||
f'## [{v1}] - Unreleased', | ||
'###Added', | ||
'* n/a', | ||
'###Fixed', | ||
'* n/a', | ||
'###Updated', | ||
'* n/a', | ||
'###Breaking changes', | ||
'* n/a', | ||
'' | ||
] | ||
content = content.replace('# Release History\n', '\n'.join(next_version_lines)) | ||
|
||
# Write | ||
with open(changelog_filepath, 'w') as fp: | ||
fp.write(content) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,39 @@ | ||
# Release History | ||
|
||
## [0.0.9] | ||
|
||
**Added** | ||
- | ||
|
||
**Fixed** | ||
- | ||
|
||
**Updated** | ||
- | ||
## [0.0.9] - Unreleased | ||
###Added | ||
* Documentation | ||
|
||
## [0.0.8] - 2023-09-24 | ||
|
||
**Added** | ||
- Lean tests for installation without optional dependencies | ||
###Added | ||
* Lean tests for installation without optional dependencies | ||
|
||
## [0.0.7] - 2023-09-24 | ||
|
||
**Fixed** | ||
- ModuleNotFoundError with optional dependencies | ||
|
||
###Fixed | ||
* ModuleNotFoundError with optional dependencies | ||
|
||
## [0.0.6] - 2023-09-23 | ||
**Fixed** | ||
- ModuleNotFoundError with optional dependencies | ||
|
||
**Updated** | ||
- Documentation to include required environment variables. | ||
###Fixed | ||
* ModuleNotFoundError with optional dependencies | ||
###Updated | ||
* Documentation to include required environment variables. | ||
|
||
## [0.0.5] - 2023-09-22 | ||
**Added** | ||
- Support for AWS secrets | ||
###Added | ||
* Support for AWS secrets | ||
|
||
## [0.0.4] - 2023-09-21 | ||
**Added** | ||
- Support for the same alias(es) used across multiple fields | ||
###Added | ||
* Support for the same alias(es) used across multiple fields | ||
|
||
## [0.0.3] - 2023-09-17 | ||
**Added** | ||
- Azure Keyvault support | ||
###Added | ||
* Azure Keyvault support | ||
|
||
## [0.0.2] - 2023-07-30 | ||
**Updated** | ||
- Changed build backend from flit to setuptools | ||
###Updated | ||
* Changed build backend from flit to setuptools | ||
|
||
## [0.0.1] - 2023-07-16 | ||
**Added** | ||
- Initial pypi release | ||
###Added | ||
* Initial pypi release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.