@@ -91,142 +91,44 @@ jobs:
9191 scan-type : sbom
9292 output-file : dist/pymqrest-${{ steps.version.outputs.version }}.cdx.json
9393
94- - name : Configure git identity
94+ - name : Tag and release
9595 if : steps.tag_check.outputs.exists == 'false'
96- run : |
97- git config user.name "github-actions[bot]"
98- git config user.email "github-actions[bot]@users.noreply.github.com"
99-
100- - name : Create git tag
101- if : steps.tag_check.outputs.exists == 'false'
102- run : |
103- git tag -a "${{ steps.version.outputs.tag }}" \
104- -m "Release ${{ steps.version.outputs.version }}"
105- git push origin "${{ steps.version.outputs.tag }}"
106-
107- - name : Tag develop for changelog boundaries
108- if : steps.tag_check.outputs.exists == 'false'
109- run : |
110- git fetch origin develop
111- git tag "develop-${{ steps.version.outputs.tag }}" origin/develop
112- git push origin "develop-${{ steps.version.outputs.tag }}"
113-
114- - name : Create GitHub Release
115- if : steps.tag_check.outputs.exists == 'false'
116- env :
117- GH_TOKEN : ${{ github.token }}
118- run : |
119- gh release create "${{ steps.version.outputs.tag }}" \
120- --title "pymqrest ${{ steps.version.outputs.version }}" \
121- --notes "$(cat <<'EOF'
122- ## Installation
96+ uses : wphillipmoore/standard-actions/actions/publish/tag-and-release@develop
97+ with :
98+ version : ${{ steps.version.outputs.version }}
99+ release-title : pymqrest
100+ release-notes : |
101+ ## Installation
123102
124- ```bash
125- pip install pymqrest==${{ steps.version.outputs.version }}
126- ```
103+ ```bash
104+ pip install pymqrest==${{ steps.version.outputs.version }}
105+ ```
127106
128- ## Links
107+ ## Links
129108
130- - [PyPI](https://pypi.org/project/pymqrest/${{ steps.version.outputs.version }}/)
131- - [Documentation](https://wphillipmoore.github.io/mq-rest-admin-python/)
132- EOF
133- )" \
134- dist/*
135-
136- - name : Compute next patch version
137- id : next_version
138- run : |
139- next=$(python3 -c "
140- v = '${{ steps.version.outputs.version }}'.split('.')
141- v[2] = str(int(v[2]) + 1)
142- print('.'.join(v))
143- ")
144- echo "version=$next" >> "$GITHUB_OUTPUT"
145- echo "branch=chore/bump-version-$next" >> "$GITHUB_OUTPUT"
146-
147- - name : Check if develop already has next version
148- id : bump_check
149- run : |
150- git fetch origin develop
151- current=$(git show origin/develop:pyproject.toml | python3 -c "
152- import sys, tomllib
153- print(tomllib.loads(sys.stdin.read())['project']['version'])
154- ")
155- if [ "$current" = "${{ steps.next_version.outputs.version }}" ]; then
156- echo "needed=false" >> "$GITHUB_OUTPUT"
157- else
158- echo "needed=true" >> "$GITHUB_OUTPUT"
159- fi
109+ - [PyPI](https://pypi.org/project/pymqrest/${{ steps.version.outputs.version }}/)
110+ - [Documentation](https://wphillipmoore.github.io/mq-rest-admin-python/)
111+ release-artifacts : dist/*
160112
161113 - name : Generate app token for bump PR
162- if : steps.bump_check .outputs.needed == 'true '
114+ if : steps.tag_check .outputs.exists == 'false '
163115 id : app-token
164116 uses : actions/create-github-app-token@v1
165117 with :
166118 app-id : ${{ secrets.APP_ID }}
167119 private-key : ${{ secrets.APP_PRIVATE_KEY }}
168120
169- - name : Create version bump PR
170- if : steps.bump_check.outputs.needed == 'true'
171- env :
172- GH_TOKEN : ${{ steps.app-token.outputs.token }}
173- run : |
174- git checkout -b "${{ steps.next_version.outputs.branch }}" origin/develop
175- git merge origin/main --no-edit
176-
177- python3 -c "
178- from pathlib import Path
179- import re
180- p = Path('pyproject.toml')
181- content = p.read_text()
182- content = re.sub(
183- r'^(version\s*=\s*\").*(\"\s*)$',
184- r'\g<1>${{ steps.next_version.outputs.version }}\2',
185- content,
186- count=1,
187- flags=re.MULTILINE,
188- )
189- p.write_text(content)
190- "
191-
192- uv lock --upgrade
193- uv export --no-hashes -o requirements.txt
194- uv export --no-hashes --group dev -o requirements-dev.txt
195-
196- git add pyproject.toml uv.lock requirements.txt requirements-dev.txt
197- git commit -m "chore: bump version to ${{ steps.next_version.outputs.version }}"
198- git push origin "${{ steps.next_version.outputs.branch }}"
199-
200- pr_url=$(gh pr create \
201- --base develop \
202- --head "${{ steps.next_version.outputs.branch }}" \
203- --title "chore: bump version to ${{ steps.next_version.outputs.version }}" \
204- --body "Automated patch version bump after publishing ${{ steps.version.outputs.version }}.
205-
206- This merges \`main\` back into \`develop\` to pick up the changelog and any
207- other release-branch artifacts, then sets the working version to the next
208- expected patch release. Change this to a minor or major bump if the next
209- release warrants it.
210-
211- Dependencies are refreshed to their latest compatible versions
212- via \`uv lock --upgrade\`.")
213-
214- pr_number="${pr_url##*/}"
215- gh pr edit "$pr_number" --body "Automated patch version bump after publishing ${{ steps.version.outputs.version }}.
216-
217- This merges \`main\` back into \`develop\` to pick up the changelog and any
218- other release-branch artifacts, then sets the working version to the next
219- expected patch release. Change this to a minor or major bump if the next
220- release warrants it.
221-
222- Dependencies are refreshed to their latest compatible versions
223- via \`uv lock --upgrade\`.
224-
225- Ref #${pr_number}"
226-
227- gh pr close "$pr_number"
228- gh pr reopen "$pr_number"
229-
230- gh pr merge \
231- --auto --merge --delete-branch \
232- "${{ steps.next_version.outputs.branch }}"
121+ - name : Version bump PR
122+ if : steps.tag_check.outputs.exists == 'false'
123+ uses : wphillipmoore/standard-actions/actions/publish/version-bump-pr@develop
124+ with :
125+ current-version : ${{ steps.version.outputs.version }}
126+ version-file : pyproject.toml
127+ version-regex : ' ^(version\s*=\s*\").*(\"\s*)$'
128+ version-replacement : ' \g<1>{version}\2'
129+ version-regex-multiline : " true"
130+ develop-version-command : python3 -c "import sys, tomllib; print(tomllib.loads(sys.stdin.read())['project']['version'])"
131+ post-bump-command : uv lock --upgrade && uv export --no-hashes -o requirements.txt && uv export --no-hashes --group dev -o requirements-dev.txt
132+ extra-files : uv.lock requirements.txt requirements-dev.txt
133+ app-token : ${{ steps.app-token.outputs.token }}
134+ pr-body-extra : Dependencies are refreshed to their latest compatible versions via `uv lock --upgrade`.
0 commit comments