Skip to content

Commit c1e0a7b

Browse files
Copilotjgray-19
andauthored
Add package version bump to MAD-NG release workflow (#32)
* Initial plan * Modify bump-mad-ng-release workflow to also bump package version Co-authored-by: jgray-19 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jgray-19 <[email protected]>
1 parent bf7e09e commit c1e0a7b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/bump-mad-ng-release.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow updates the MAD-NG version across the repository
2-
# It updates the version in workflows, test inputs, and changelog
2+
# It updates the version in workflows, test inputs, changelog, and package version
33

44
name: Bump MAD-NG release
55

@@ -14,6 +14,10 @@ on:
1414
description: 'Major.minor version for URL path (e.g., 1.1)'
1515
required: true
1616
type: string
17+
package_version:
18+
description: 'New package version for pymadng (e.g., 0.8.2)'
19+
required: true
20+
type: string
1721
changelog_entry:
1822
description: 'Changelog entry for this update (optional)'
1923
required: false
@@ -42,6 +46,11 @@ jobs:
4246
echo "Error: major_minor must be in x.y format (e.g., 1.1)"
4347
exit 1
4448
fi
49+
# Validate package_version format (semver: x.y.z)
50+
if ! echo "${{ inputs.package_version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
51+
echo "Error: package_version must be in semver format (e.g., 0.8.2)"
52+
exit 1
53+
fi
4554
echo "Inputs validated successfully"
4655
4756
- name: Get current version
@@ -76,6 +85,12 @@ jobs:
7685
sed -i "s/\[${{ steps.current.outputs.version }}\]/[${{ inputs.new_version }}]/g" tests/inputs/example.log
7786
echo "Updated example.log"
7887
88+
- name: Update package version
89+
run: |
90+
# Update __version__ in src/pymadng/__init__.py
91+
sed -i -E "s/__version__ = \"[0-9]+\.[0-9]+\.[0-9]+\"/__version__ = \"${{ inputs.package_version }}\"/" src/pymadng/__init__.py
92+
echo "Updated package version to ${{ inputs.package_version }}"
93+
7994
- name: Update CHANGELOG.md
8095
run: |
8196
CHANGELOG_ENTRY="${{ inputs.changelog_entry }}"
@@ -87,8 +102,11 @@ jobs:
87102
CURRENT_DATE=$(date +%Y/%m/%d)
88103
89104
# Prepend new version entry to CHANGELOG.md with proper format
105+
# Format: version (date) \
106+
# changelog entry
90107
TEMP_FILE=$(mktemp)
91-
echo "$CHANGELOG_ENTRY ($CURRENT_DATE)" > "$TEMP_FILE"
108+
echo "${{ inputs.package_version }} ($CURRENT_DATE) \\" > "$TEMP_FILE"
109+
echo "$CHANGELOG_ENTRY" >> "$TEMP_FILE"
92110
echo "" >> "$TEMP_FILE"
93111
cat CHANGELOG.md >> "$TEMP_FILE"
94112
mv "$TEMP_FILE" CHANGELOG.md
@@ -98,19 +116,25 @@ jobs:
98116
uses: peter-evans/create-pull-request@v7
99117
with:
100118
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
101-
commit-message: "Bump MAD-NG version to ${{ inputs.new_version }}"
102-
title: "Bump MAD-NG version to ${{ inputs.new_version }}"
119+
commit-message: "Bump MAD-NG to ${{ inputs.new_version }} and package to ${{ inputs.package_version }}"
120+
title: "Bump MAD-NG to ${{ inputs.new_version }} and pymadng to ${{ inputs.package_version }}"
103121
body: |
104-
This PR updates the MAD-NG version from ${{ steps.current.outputs.version }} to ${{ inputs.new_version }}.
122+
This PR updates the MAD-NG version from ${{ steps.current.outputs.version }} to ${{ inputs.new_version }} and bumps the package version to ${{ inputs.package_version }}.
105123
106124
## Changes
107125
- Updated `.github/workflows/test-pymadng.yml`
108126
- Updated `.github/workflows/python-publish.yml`
109127
- Updated `tests/inputs/example.log`
128+
- Updated `src/pymadng/__init__.py` (package version)
110129
- Updated `CHANGELOG.md`
111130
112131
## MAD-NG Release
113-
New version: ${{ inputs.new_version }}
132+
New MAD-NG version: ${{ inputs.new_version }}
114133
Major.minor: ${{ inputs.major_minor }}
134+
135+
## Package Release
136+
New package version: ${{ inputs.package_version }}
137+
138+
After merging this PR, create a release with tag `v${{ inputs.package_version }}` to publish to PyPI.
115139
branch: bump-madng-${{ inputs.new_version }}
116140
base: main

0 commit comments

Comments
 (0)