-
Notifications
You must be signed in to change notification settings - Fork 345
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
Add script to update version #405
Merged
Merged
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
deeba8b
add update_version script
andrew-fleming ecab3cd
add script to checklist
andrew-fleming 48c0972
fix glob
andrew-fleming 13eafe3
update branch Merge branch 'main' into update-version
andrew-fleming 4d5e9d5
add line
andrew-fleming 1f99f47
add antora path to script
andrew-fleming 679afb1
add version bump job
andrew-fleming 7eebefe
add version dep
andrew-fleming 0320178
update RELEASING with new CI workflow
andrew-fleming 188871e
add token for checkout
andrew-fleming 60f9444
fix conflicts
andrew-fleming c10dafb
Update .github/workflows/python-app.yml
martriay 7d954ec
change dep tag to commit hash
andrew-fleming f558118
update branch Merge remote-tracking branch 'refs/remotes/origin/updat…
andrew-fleming 9d3f943
Update .github/workflows/python-app.yml
andrew-fleming 2976668
Apply suggestions from code review
andrew-fleming 2f4ed68
merge release branch to main in version job
andrew-fleming b687c18
fix git push format
andrew-fleming a2e8cac
remove blockquote
andrew-fleming 6208423
add branch checkout to checklist
andrew-fleming c290e71
Apply suggestions from code review
andrew-fleming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fileinput | ||
import sys | ||
from pathlib import Path | ||
|
||
CURRENT_VERSION = "v0.2.1" | ||
martriay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ANTORA_PATH = "docs/antora.yml" | ||
|
||
|
||
def main(): | ||
new_version = str(sys.argv[1]) | ||
path = Path("src") | ||
for p in path.glob("**/*.cairo"): | ||
_update_version(p, new_version) | ||
_update_version(ANTORA_PATH, new_version) | ||
_update_version("scripts/update_version.py", new_version) | ||
|
||
|
||
def _update_version(path, version): | ||
with fileinput.input(path, inplace=True) as file: | ||
for line in file: | ||
old, new = CURRENT_VERSION, version | ||
if path == ANTORA_PATH: | ||
old = old.strip("v") | ||
new = new.strip("v") | ||
new_line = line.replace(old, new) | ||
print(new_line, end="") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why the specific hash?
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.
To mitigate risk. I think it's a safer play since we're using a third-party action here
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.
do you know if devs can overwrite a version name? in any case the commit hash it's more certain
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.
Agreed on the certainty^ And yes, I believe devs can replace the tag in git