Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .ci/catchup_pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

echo "setting email and name config"
git config --local user.email "wai.phyo@jpl.nasa.gov"
git config --local user.name ${GITHUB_TRIGGERING_ACTOR}


echo "creating PR"
result=`gh pr create --base "develop" --body "NA" --head "main" --title "chore: catchup from main"`
echo "PR result $result"
pr_number=`echo $result | grep -oE '[0-9]+$'`
echo "PR number ${pr_number}"
47 changes: 44 additions & 3 deletions .ci/update_setup_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,50 @@ def update_change_log(self):
change_log_file.write(change_logs)
return

def generate_release_msg(self):
software_version = os.environ.get('software_version', '')
if software_version == '':
raise ValueError(f'missing software_version')
release_lines = {
'Added': ['### Added'],
'Fixed': ['### Fixed'],
'Changed': ['### Changed'],
}
change_log_path = os.path.join(self.root_dir, 'CHANGELOG.md')
with open(change_log_path, 'r') as ff:
all_lines = ff.read().splitlines()
i = 0
while i < len(all_lines):
if f'{software_version}.dev' not in all_lines[i]:
i += 1
continue
release_lines[all_lines[i+1].replace('###', '').strip()].append(all_lines[i+2])
i += 3

message = [
f'Link: https://pypi.org/project/mdps-ds-lib/{software_version}/',
'',
'Changes in this release:',
''
] + \
(release_lines['Added'] if len(release_lines['Added']) > 1 else []) + \
(release_lines['Fixed'] if len(release_lines['Fixed']) > 1 else []) + \
(release_lines['Changed'] if len(release_lines['Changed']) > 1 else [])
message = '\n'.join(message)
release_path = os.path.join(self.root_dir, 'release_body.txt')
with open(release_path, 'w') as f:
f.write(message)
return message


if __name__ == '__main__':
is_releasing = argv[1].strip().upper() == 'RELEASE'
arg1 = argv[1].strip().upper()
version_update = VersionUpdate()
new_version_from_setup = version_update.update_version(is_releasing)
version_update.update_change_log()
if arg1 == 'RELEASE_BODY':
new_version_from_setup = version_update.generate_release_msg()
elif argv[1].strip().upper() == 'RELEASE':
new_version_from_setup = version_update.update_version(True)
version_update.update_change_log()
else:
new_version_from_setup = version_update.update_version(False)
version_update.update_change_log()
17 changes: 13 additions & 4 deletions .github/workflows/feature_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,25 @@ jobs:
run: |
python3 -m twine upload --repository pypi dist/*

- name: MAIN -- Catch up PR
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
chmod +x "${GITHUB_WORKSPACE}/.ci/catchup_pr.sh"
"${GITHUB_WORKSPACE}/.ci/catchup_pr.sh"


- name: MAIN -- Upload to PyPI
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
# make file runnable, might not be necessary
chmod +x "${GITHUB_WORKSPACE}/.ci/store_version.sh"
"${GITHUB_WORKSPACE}/.ci/store_version.sh"

- name: MAIN -- Create Release Body
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
run: |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" RELEASE_BODY

- name: MAIN -- Create Release
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log')
id: create_release
Expand All @@ -111,9 +123,6 @@ jobs:
with:
tag_name: "v${{ env.software_version }}"
release_name: "Release v${{ env.software_version }} - ${{ github.ref }}"
body: |
Changes in this release:
${{ github.event.head_commit.message }}
body_path: release.md
body_path: ./release_body.txt
draft: false
prerelease: false
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0.dev000200] - 2024-09-18
### Changed
- [#34](https://github.com/unity-sds/unity-data-services/pull/34) feat: new ways to write release notes

## [0.4.0] - 2024-09-18

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mdps-ds-lib"
version="0.4.0"
version="0.4.0.dev000200"
description = "Mission Data System - MDPS (Unity) Data Service Core library"
authors = ["Wai Phyo <wai.phyo@jpl.nasa.gov>"]
license = "Apache 2.0"
Expand Down