-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: dynamically parse the latest/actual release version when building docs #312
Conversation
@sbillinge ready for review |
|
||
# Get the latest release version from GitHub repository | ||
org = "diffpy" | ||
repo_name = "diffpy.utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can dynamically get these information in our cookiecutting standard
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 516 516
=========================================
Hits 516 516 |
fullversion = version(project) | ||
# The short X.Y version. | ||
version = "".join(fullversion.split(".post")[:1]) | ||
# The full version, including alpha/beta/rc tags. | ||
release = fullversion | ||
release = latest_verion_from_github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this release
variable becomes the software version in src/index.rst
This is a nice workaround, but I wonder if it is taking us in the right direction. When we make a tag, we want it to actually tag something meaningful. Presumably the 3.6.0 tag should tag the 3.6.0 release, which actually, should include the built changelog. I wonder if our changelog workflow could somehow delete the tag on upstream and then remake it after the CHANGELOG is merged instead? I am not sure if that is possible. |
I agree.
This could be it. I can look into this. I will report back |
@sbillinge it's actually working. Thanks for the GREAT idea. delete-create-new-tag:
# For a full release, we delete and create a new tag to reflect the latest changes in the CHANGELOG.rst.
# Recall that during the full release, the `main` branch's CHANGELOG.rst has been updated, and we want the
# tag to reflect the latest changes in the CHANGELOG.rst done by the update-changelog above.
# For more discussions, please read https://github.com/Billingegroup/release-scripts/pull/120
....
uses: actions/checkout@v4
with:
ref: main
- name: Delete the tag
run: |
git fetch --tags
git tag -d "${{ github.ref_name }}"
git push origin ":${{ github.ref_name }}"
- name: Create a new tag (Expect commit SHA to match with that of main branch)
run: |
git tag "${{ github.ref_name }}"
git push origin "${{ github.ref_name }}" Will update PRs after lunch. |
@sbillinge - closing this PR, tag creation/deletion is handled by release-scripts.. |
Problem
I was wondering why the online doc never displayed the latest release notes (i.g. 3.5.0) when we push 3.5.0 tag, even though
CHANGELOG.rst
contains 3.5.0 information inmain
.It turns outs, when we checkout the repository to build the doc, we checked out the commit of the tag, not the
main
repository which contains the modifiedCHANGELOG.rst
. The reason we checked out the tag is that it always displayed the correct version number. However, themain
branch contains an additional commit that modifies CHANGLEOG.rst by the CI. This is what we (I) failed to recognize for a while.Proposed solution
Hence, we need to build docs by checking out the
main
branch as shown in this PR (https://github.com/Billingegroup/release-scripts/pull/120/files#r1900318116). However, it doesn't have the tag information that can be automatically detected by ourgit-versioning
dependency. How do we still get the right tag version? We can dynamically parse the latest release from GitHub's release viarequests
- hence the changes in this code.Result:
Shown below, I have tested this implementation using my dummy org/repo that does full release of
0.5.14
, using a single run of git tag and push: